/**
 * ROViZO ERP - Corporate OS-Like Stylesheet
 * High-end Desktop Application Feel with Mobile Responsiveness
 */

:root {
    --side-bg: #0f172a;
    /* Koyu Slate - EXE Sidebar */
    --side-hover: #1e293b;
    --accent: #3b82f6;
    /* ROViZO Mavi */
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --header-h: 70px;
    --sidebar-w: 260px;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
    height: 100vh;
}

/* Layout Engine */
.app-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar - EXE Sytle */
.sidebar {
    width: var(--sidebar-w);
    background-color: var(--side-bg);
    color: #f1f5f9;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    height: var(--header-h);
    display: flex;
    align-items: center;
    padding: 0 24px;
    background: rgba(0, 0, 0, 0.2);
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 22px;
    letter-spacing: -1px;
}

.sidebar-brand span {
    color: var(--accent);
    margin-left: 5px;
}

.nav-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.nav-group {
    margin-bottom: 25px;
}

.nav-label {
    padding: 0 24px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 1px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 4px solid transparent;
    cursor: pointer;
    position: relative;
    user-select: none;
}

.nav-link i:first-child {
    width: 20px;
    margin-right: 12px;
    font-size: 16px;
    opacity: 0.7;
}

.nav-link .arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.3s;
    opacity: 0.5;
}

.nav-link.open .arrow {
    transform: rotate(180deg);
}

.nav-link:hover {
    background: var(--side-hover);
    color: #fff;
}

.nav-link:hover i {
    opacity: 1;
}

.nav-link.active {
    background: #1e293b;
    color: #fff;
    border-left-color: var(--accent);
}

.nav-link.active i {
    color: var(--accent);
    opacity: 1;
}

/* Submenu Styles */
.submenu {
    max-height: 0;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.15);
    transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
}

.nav-link.open+.submenu {
    max-height: 1000px;
    transition: max-height 0.3s cubic-bezier(1, 0, 1, 0);
}

.submenu .nav-link {
    padding-left: 52px;
    font-size: 13px;
    border-left: none;
    background: transparent;
}

/* Nested Submenu (Level 3) */
.submenu .submenu .nav-link {
    padding-left: 72px;
    font-size: 12px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Main Workspace */
.main-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Box model fix */
}

/* Global Header */
.top-header {
    height: var(--header-h);
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: relative;
    z-index: 50;
    /* Lower than modal */
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-main);
}

.global-search {
    position: relative;
    width: 350px;
}

.global-search input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #f1f5f9;
    font-size: 14px;
    outline: none;
}

.global-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.action-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #f1f5f9;
    color: var(--accent);
}

.dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: var(--error);
    border-radius: 50%;
    border: 2px solid white;
}

.user-profile-wrapper {
    position: relative;
    z-index: 2005;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    background: #f8fafc;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.user-profile:hover {
    border-color: var(--accent);
    background: #fff;
}

.user-profile img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    background: #e2e8f0;
}

.user-meta {
    line-height: 1.2;
}

.user-meta span {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.user-meta small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 240px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    display: none;
    margin-top: 12px;
    overflow: hidden;
    z-index: 3000;
}

.profile-dropdown.show {
    display: block;
    animation: dropdownJump 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes dropdownJump {
    from {
        opacity: 0;
        transform: translateY(-15px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dropdown-item {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #1e293b;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: #f1f5f9;
    color: var(--accent);
    padding-left: 22px;
}

.dropdown-item i {
    width: 18px;
    font-size: 18px;
    opacity: 0.7;
}

.dropdown-item.logout {
    color: #ef4444;
    border-top: 1px solid #f1f5f9;
}

/* Workspace Content */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.page-head {
    margin-bottom: 30px;
}

.page-head h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--text-main);
}

.page-head p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 5px;
}

/* Dashboard Grid */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.stat-box {
    background: white;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.stat-icon {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    font-family: 'Outfit';
    margin-bottom: 5px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Operational Panels */
.ops-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
}

.ops-card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-title {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

/* Table EXE Sytle */
.exe-table {
    width: 100%;
    border-collapse: collapse;
}

.exe-table th {
    background: #f8fafc;
    text-align: left;
    padding: 12px 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

.exe-table td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    .dash-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ops-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        transform: translateX(-100%);
        height: 100vh;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .mobile-toggle {
        display: block;
    }

    .global-search {
        display: none;
    }

    .main-workspace {
        margin-left: 0;
    }

    .dash-grid {
        grid-template-columns: 1fr;
    }
}

/* Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: white;
    width: 95%;
    /* Use more width on small screens */
    max-width: 1100px;
    /* Increased to allow more horizontal room */
    max-height: 90vh;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    flex-shrink: 0;
}

.modal-header h4 {
    font-family: 'Outfit';
    font-size: 20px;
    font-weight: 700;
}

@media (max-width: 768px) {
    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-header {
        padding: 15px;
    }

    .modal-header h4 {
        font-size: 16px;
    }

    .modal-body {
        padding: 15px;
    }

    .detail-grid {
        gap: 15px;
    }

    /* Modal içindeki flex yapıları mobilde alt alta gelsin */
    #modalBody [style*="display: flex"] {
        flex-direction: column !important;
        gap: 10px !important;
    }

    #modalBody [style*="grid-template-columns: repeat(2, 1fr)"] {
        grid-template-columns: 1fr !important;
    }

    #modalBody div[style*="text-align: right"] {
        text-align: left !important;
        padding-left: 0 !important;
        border-top: 1px dashed #eee;
        padding-top: 10px;
    }
}

.close-modal, .close-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
}

.close-modal:hover, .close-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
    padding: 25px;
}

/* Detail View Components */
.detail-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    /* Fixed left, flexible right */
    gap: 25px;
}

@media (max-width: 1024px) {
    .detail-grid {
        grid-template-columns: 1fr;
        /* Stack on smaller screens */
    }
}

.detail-section {
    margin-bottom: 25px;
}

.section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

.detail-card {
    background: #f8fafc;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
}

.info-row:last-child {
    border: none;
}

.info-label {
    font-size: 12px;
    color: var(--text-muted);
}

.info-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.copy-btn {
    cursor: pointer;
    color: var(--accent);
    opacity: 0.4;
    transition: all 0.2s;
    font-size: 12px;
}

.copy-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* Toast System */
.toast-msg {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--side-bg);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    z-index: 5000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-msg.show {
    transform: translateX(-50%) translateY(0);
}

/* 
 * PREMIUM UI COMPONENTS
 * Global components for marketplace pages
 */

.card-premium {
    background: white;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    padding: 24px;
    margin-bottom: 24px;
}

.premium-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.premium-table th {
    background: #f8fafc;
    padding: 16px 20px;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #f1f5f9;
    text-align: left;
}

.premium-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 14px;
    color: #1e293b;
}

.premium-table tr:hover td {
    background-color: #f8fafc;
}

.filter-card {
    padding: 20px 24px;
}

.filter-flex {
    display: flex;
    gap: 20px;
    align-items: flex-end;
}

.filter-flex .form-group {
    margin-bottom: 0;
}

.filter-flex label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.filter-flex input,
.filter-flex select {
    width: 100%;
    padding: 10px 15px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #f8fafc;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.filter-flex input:focus {
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.stat-card .stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-card h3 {
    font-size: 24px;
    font-weight: 800;
    font-family: 'Outfit';
    color: var(--text-main);
    line-height: 1;
}

.stat-card p {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 5px;
}

.btn-primary,
.btn-secondary {
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 14px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.order-num-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.product-mini {
    display: flex;
    flex-direction: column;
}

.p-name {
    font-weight: 600;
    color: #1e293b;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.p-sku {
    font-size: 12px;
    color: var(--text-muted);
}

.date-cell {
    display: flex;
    flex-direction: column;
    font-size: 13px;
}

.status-badge {
    display: inline-flex;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.status-shipped {
    background: #e0f2fe;
    color: #0369a1;
}

.status-delivered {
    background: #dcfce7;
    color: #15803d;
}

.status-cancelled {
    background: #fee2e2;
    color: #b91c1c;
}

/* Modal Custom Premium */
.modal-premium {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.modal-premium.active {
    display: flex;
}

.modal-premium .modal-content {
    background: white;
    border-radius: 24px;
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* 
 * POS SALES PAGE SPECIFIC 
 */
.marketplace-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
}
.badge-hepsiburada { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.badge-trendyol { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.badge-n11 { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.badge-direct { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

.match-badge {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
.match-success { background: #dcfce7; color: #15803d; }
.match-fail { background: #fef2f2; color: #b91c1c; }

.sync-btn-large {
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 700;
    font-family: 'Outfit';
    font-size: 15px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sync-btn-large:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}
.sync-btn-large:active { transform: translateY(0); }

.status-pill {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.raw-data-container {
    background: #1e293b;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 12px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
}
