/* ===================================
   TesseraX Labs - Custom Styles
   =================================== */

/* ===================================
   1. CSS Variables & Root Styles
   =================================== */
:root {
    --primary-black: #000000;
    --primary-white: #ffffff;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-800: #1a1a1a;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --primary-black: #ffffff;
    --primary-white: #1a1a1a;
    --gray-100: #2a2a2a;
    --gray-200: #3a3a3a;
    --gray-800: #f8f9fa;
}

/* ===================================
   2. Dark Mode Styles
   =================================== */
body[data-theme="dark"] {
    background: #1a1a1a;
    color: #ffffff;
}

body[data-theme="dark"] .navbar {
    background: #1a1a1a !important;
    box-shadow: 0 2px 10px rgba(255,255,255,0.1);
}

body[data-theme="dark"] .hero {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
}

body[data-theme="dark"] .hero p {
    color: #cccccc;
}

body[data-theme="dark"] .about-section {
    background: #2a2a2a;
}

body[data-theme="dark"] .service-card,
body[data-theme="dark"] .stats-card {
    background: #2a2a2a;
    border-color: #3a3a3a;
    color: #ffffff;
}

body[data-theme="dark"] .service-card:hover {
    border-color: #ffffff;
}

body[data-theme="dark"] .service-card::before {
    background: #ffffff;
}

body[data-theme="dark"] .service-card:hover * {
    color: #1a1a1a !important;
}

body[data-theme="dark"] .portfolio-item {
    border-color: #3a3a3a;
    background: #2a2a2a;
}

body[data-theme="dark"] .portfolio-overlay {
    background: rgba(255,255,255,0.95);
}

body[data-theme="dark"] .portfolio-overlay h4 {
    color: #1a1a1a;
}

body[data-theme="dark"] .portfolio-overlay p {
    color: #666;
}

body[data-theme="dark"] .contact-section {
    background: #0a0a0a;
}

body[data-theme="dark"] .form-control {
    background: #2a2a2a;
    border-color: #3a3a3a;
    color: #ffffff;
}

body[data-theme="dark"] .form-control:focus {
    background: #2a2a2a;
    border-color: #ffffff;
}

body[data-theme="dark"] footer {
    background: #0a0a0a;
}

body[data-theme="dark"] .text-muted {
    color: #999 !important;
}

body[data-theme="dark"] .btn-custom {
    background: var(--primary-white);
    color: var(--primary-black);
    border-color: var(--primary-white);
}

body[data-theme="dark"] .btn-custom:hover {
    background: transparent;
    color: var(--primary-white);
    border-color: var(--primary-white);
}

body[data-theme="dark"] .btn-outline-custom {
    border-color: var(--primary-white);
    color: var(--primary-white);
}

body[data-theme="dark"] .btn-outline-custom:hover {
    background: var(--primary-white);
    color: var(--primary-black);
}

body[data-theme="dark"] .scroll-top {
    background: var(--primary-white);
    color: var(--primary-black);
}

body[data-theme="dark"] .service-icon {
    color: var(--primary-white);
}

body[data-theme="dark"] .stats-number {
    color: var(--primary-white);
}

body[data-theme="dark"] .navbar-toggler-icon {
    filter: invert(1);
}

body[data-theme="dark"] .theme-toggle,
body[data-theme="dark"] .lang-toggle {
    border-color: var(--primary-white);
    color: var(--primary-white);
}

body[data-theme="dark"] .theme-toggle:hover,
body[data-theme="dark"] .lang-toggle:hover {
    background: var(--primary-white);
    color: var(--primary-black);
}

/* ===================================
   3. Base Styles
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--primary-black);
    background: var(--primary-white);
    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
}

/* ===================================
   4. Navigation Styles
   =================================== */
.navbar {
    background: var(--primary-white) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 1rem 0;
    transition: var(--transition);
}

.navbar.scrolled {
    padding: 0.5rem 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.navbar-brand {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-black) !important;
    letter-spacing: -1px;
}

.navbar-brand span {
    color: var(--primary-black);
    font-weight: 300;
}

.nav-link {
    color: var(--primary-black) !important;
    font-weight: 500;
    margin: 0 0.5rem;
    position: relative;
    transition: var(--transition);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-black);
    transition: var(--transition);
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 80%;
}

/* ===================================
   5. Hero Section
   =================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-white) 0%, var(--gray-100) 100%);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0,0,0,0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    animation: moveGrid 20s linear infinite;
}

@keyframes moveGrid {
    0% { transform: translate(0, 0); }
    100% { transform: translate(30px, 30px); }
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero h1 {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    animation: fadeInUp 1s ease;
}

.hero p {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 2rem;
    animation: fadeInUp 1s ease 0.2s backwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   6. Button Styles
   =================================== */
.btn-custom {
    padding: 1rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid var(--primary-black);
    background: var(--primary-black);
    color: var(--primary-white);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-custom::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--primary-white);
    transition: var(--transition);
    z-index: -1;
}

.btn-custom:hover {
    color: var(--primary-black);
    border-color: var(--primary-black);
}

.btn-custom:hover::before {
    left: 0;
}

.btn-outline-custom {
    padding: 1rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid var(--primary-black);
    background: transparent;
    color: var(--primary-black);
    transition: var(--transition);
    margin-left: 1rem;
}

.btn-outline-custom:hover {
    background: var(--primary-black);
    color: var(--primary-white);
}

/* ===================================
   7. Section Styles
   =================================== */
.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--primary-black);
}

/* ===================================
   8. Service Cards
   =================================== */
.service-card {
    padding: 2.5rem;
    border: 2px solid var(--gray-200);
    transition: var(--transition);
    background: var(--primary-white);
    height: 100%;
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--primary-black);
    transition: var(--transition);
    z-index: 0;
}

.service-card:hover::before {
    left: 0;
}

.service-card:hover {
    border-color: var(--primary-black);
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.service-card:hover * {
    color: var(--primary-white) !important;
}

.service-card > * {
    position: relative;
    z-index: 1;
    transition: var(--transition);
}

.service-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    color: var(--primary-black);
}

.service-card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* ===================================
   9. About Section
   =================================== */
.about-section {
    background: var(--gray-100);
}

.stats-card {
    text-align: center;
    padding: 2rem;
    background: var(--primary-white);
    border: 2px solid var(--gray-200);
    transition: var(--transition);
}

.stats-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-black);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.stats-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-black);
}

.stats-label {
    font-size: 1rem;
    color: #666;
    margin-top: 0.5rem;
}

/* ===================================
   10. Portfolio Section
   =================================== */
.portfolio-item {
    position: relative;
    overflow: hidden;
    border: 2px solid var(--gray-200);
    height: 300px;
    background: var(--gray-100);
}

.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    opacity: 0;
    transition: var(--transition);
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

.portfolio-overlay h4 {
    color: var(--primary-white);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.portfolio-overlay p {
    color: var(--gray-200);
}

/* ===================================
   11. Contact Section
   =================================== */
.contact-section {
    background: var(--primary-black);
    color: var(--primary-white);
}

.contact-info {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
}

.contact-icon {
    font-size: 2rem;
    margin-right: 1.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--primary-white);
    border-radius: 50%;
}

.form-control, .form-select {
    padding: 1rem;
    border: 2px solid var(--gray-200);
    background: var(--primary-white);
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-black);
    box-shadow: 0 0 0 0.2rem rgba(0,0,0,0.1);
}

/* ===================================
   12. Footer
   =================================== */
footer {
    background: var(--gray-800);
    color: var(--primary-white);
    padding: 3rem 0 1rem;
}

.social-links a {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border: 2px solid var(--primary-white);
    color: var(--primary-white);
    margin-right: 0.5rem;
    transition: var(--transition);
    border-radius: 50%;
}

.social-links a:hover {
    background: var(--primary-white);
    color: var(--primary-black);
}

/* ===================================
   13. Theme & Language Controls
   =================================== */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-black);
    color: var(--primary-white);
    border: 2px solid var(--primary-black);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    margin-right: 1rem;
}

.theme-toggle:hover {
    transform: rotate(180deg);
}

.lang-toggle {
    cursor: pointer;
    padding: 0.5rem 1rem;
    border: 2px solid var(--primary-black);
    background: transparent;
    color: var(--primary-black);
    font-weight: 600;
    transition: var(--transition);
    border-radius: 5px;
}

.lang-toggle:hover {
    background: var(--primary-black);
    color: var(--primary-white);
}

.controls-wrapper {
    display: flex;
    align-items: center;
}

/* ===================================
   14. Scroll to Top Button
   =================================== */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-black);
    color: var(--primary-white);
    border: none;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    z-index: 1000;
}

.scroll-top:hover {
    transform: translateY(-5px);
}

.scroll-top.show {
    display: flex;
}

/* ===================================
   15. Animations
   =================================== */
.fade-in {
    opacity: 0;
    animation: fadeIn 1s ease forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* ===================================
   16. Responsive Design
   =================================== */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }

    .hero p {
        font-size: 1.1rem;
    }

    .btn-outline-custom {
        margin-left: 0;
        margin-top: 1rem;
    }

    .section-title {
        font-size: 2rem;
    }
}