/* Design System */
:root {
    --primary: #0066ff;
    --primary-hover: #0052cc;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #22c55e;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s, transform 0.2s;
}

/* Custom Modern Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid transparent;
    background-clip: content-box;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container {
    max-width: 1400px; /* Increased for 3 columns */
    width: 100%;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    width: 100%;
}

.logo-area {
    display: flex;
    flex-direction: column;
}

.logo-text {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-text h1 {
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-area p {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
}

.version-badge {
    font-size: 0.65rem;
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 700;
    text-transform: uppercase;
}

.search-nav-area {
    flex-grow: 1;
    max-width: 500px;
    margin: 0 2rem;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 0.75rem;
    transition: all 0.3s;
}

.search-container:focus-within {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.search-container input {
    border: none;
    background: transparent;
    padding: 0.6rem 0.5rem;
    font-size: 0.9rem;
    width: 100%;
}

.search-container input:focus {
    box-shadow: none;
}

.search-icon {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

/* New Dashboard Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background: #1e293b; /* Dark like WordPress */
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 1100;
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .logo-text h1 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #60a5fa, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ec-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.6rem;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 4px 10px;
    width: fit-content;
}

.flag-emoji {
    font-size: 1rem;
    line-height: 1;
}

.ec-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #94a3b8;
}

.nav-menu {
    flex-grow: 1;
    padding: 1.5rem 0;
    overflow-y: auto;
}

.nav-section-title {
    padding: 0 1.5rem 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    font-weight: 700;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.nav-item.active {
    background: var(--primary);
    color: white;
    border-right: 4px solid #60a5fa;
}

.nav-item i {
    width: 18px;
    height: 18px;
}

/* Sidebar Groups / Accordion */
.nav-group {
    display: flex;
    flex-direction: column;
}

.nav-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-group-header:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.nav-group-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: rgba(0,0,0,0.1);
}

.nav-sub-item {
    padding: 0.6rem 1.5rem 0.6rem 3rem;
    font-size: 0.8rem;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 2px solid transparent;
}

.nav-sub-item:hover {
    color: white;
    background: rgba(255,255,255,0.02);
    border-left-color: var(--primary);
}

.nav-sub-item.escalation {
    color: #a78bfa;
}

.group-arrow {
    width: 14px;
    height: 14px;
    transition: transform 0.3s;
}

.nav-group.open .group-arrow {
    transform: rotate(180deg);
}

.nav-group.open .nav-group-header {
    color: white;
    background: rgba(255,255,255,0.03);
}

/* Adjusted Layout */
.main-layout {
    display: flex;
    margin-left: 280px;
    width: calc(100% - 280px);
    min-height: 100vh;
}

.content-wrapper {
    flex-grow: 1;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.left-panel { display: none; } /* Replaced by sidebar */

body {
    padding: 0;
    display: block;
}

.container {
    max-width: none;
    display: flex;
}

/* Category Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.card-escalate {
    border-left: 5px solid #8b5cf6; /* Violet L2 */
    background: linear-gradient(to right, rgba(139, 92, 246, 0.03), var(--bg-card));
}

.card-escalate h3 {
    color: #7c3aed;
}

.card-escalate:hover {
    border-color: #7c3aed;
}

.escalate-badge {
    background: #8b5cf6;
    color: white;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.index-item-escalate {
    color: #a78bfa !important; /* Lighter purple for dark bg */
    background: rgba(139, 92, 246, 0.1) !important;
    border-color: rgba(139, 92, 246, 0.3) !important;
}

.index-item-escalate:hover {
    background: #8b5cf6 !important;
    color: white !important;
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.card-content {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.02);
    padding: 1rem;
    border-radius: 8px;
    border: 1px dashed var(--border);
    white-space: pre-wrap;
    flex-grow: 1;
}

.btn-copy {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.8rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-copy:hover {
    background: var(--primary-hover);
    filter: brightness(1.1);
}

.btn-copy.copied {
    background: var(--success);
}

/* Variables Section */
.variables {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem; /* Reduced from 1.5rem */
    box-shadow: var(--shadow);
}

.variables-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.section-header h2 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.brand-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border-top: 4px solid var(--primary);
}

.brand-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.brand-card.samsung { border-top-color: #034EA2; }
.brand-card.motorola { border-top-color: #51b9cc; }
.brand-card.xiaomi { border-top-color: #FF6700; }
.brand-card.oppo { border-top-color: #058053; }
.brand-card.honor { border-top-color: #C69C6D; }

.brand-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--bg-main);
    color: var(--primary);
}

.brand-card h4 {
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.steps-list {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.85rem;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.steps-list li {
    line-height: 1.4;
}

.brand-card .btn-copy {
    padding: 0.5rem;
    font-size: 0.8rem;
    margin-top: auto;
}

.input-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

input {
    flex-grow: 1;
    background: var(--bg-main);
    border: 1px solid var(--border);
    padding: 0.5rem 0.8rem; /* Reduced padding */
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.9rem; /* Reduced font size */
    outline: none;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}

.variables.pinned {
    border-left: 4px solid var(--primary);
    background: linear-gradient(to right, rgba(0, 102, 255, 0.02), var(--bg-card));
}

.ticket-inputs {
    margin-bottom: 1rem;
}

.ticket-preview-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--bg-main);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.ticket-preview-container .card-content {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

.btn-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s;
}

.btn-clear:hover {
    background: var(--border);
    color: var(--text-main);
}

.btn-clear i {
    width: 16px;
    height: 16px;
}

.ticket-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 1rem;
}

.styled-select {
    background: var(--bg-main);
    border: 1px solid var(--border);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    background-size: 1.2em;
}

.styled-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}

.ticket-preview-container {
    padding: 0.6rem 0.8rem; /* Reduced padding */
}

/* History Section */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}



.history-item {
    background: var(--bg-main);
    border: 1px solid var(--border);
    padding: 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    animation: fadeIn 0.4s ease-out forwards;
}

.history-item:hover {
    border-color: var(--primary);
    background: white;
    transform: translateX(4px);
}

.history-ticket {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary);
    display: block;
    margin-bottom: 0.25rem;
}

.history-res {
    font-size: 0.8rem;
    color: var(--text-main);
    line-height: 1.3;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Compact Image Grid */
.image-grid-compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.image-grid-compact .card {
    padding: 0.5rem;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.image-grid-compact img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    border-radius: 6px;
    background: #f1f5f9;
}

.image-grid-compact p {
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.image-grid-compact .card:hover {
    border-color: var(--primary);
    background: rgba(0, 102, 255, 0.05);
}

.image-grid-compact p.copied {
    color: var(--success);
}

/* Download Button */
.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    background: rgba(0, 102, 255, 0.05);
    border: 1px dashed var(--primary);
    padding: 0.8rem;
    border-radius: 8px;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.2s;
    margin: 0.5rem 0;
}

.btn-download:hover {
    background: var(--primary);
    color: white;
    border-style: solid;
    transform: scale(1.02);
}

/* Responsive Dashboard */
@media (max-width: 1400px) {
    .right-panel { width: 260px; }
}

@media (max-width: 1200px) {
    .right-panel { display: none; }
    .main-layout { margin-left: 280px; width: calc(100% - 280px); }
}

@media (max-width: 900px) {
    .sidebar { width: 80px; }
    .sidebar-header h1, .nav-item span, .nav-section-title, .version-badge { display: none; }
    .main-layout { margin-left: 80px; width: calc(100% - 80px); }
    .nav-item { justify-content: center; padding: 1rem; }
}

@media (max-width: 600px) {
    .navbar { padding: 1rem; }
    .search-nav-area { margin: 0; }
    .user-profile span { display: none; }
}

@media (max-width: 1000px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    
    .left-panel, .side-panel {
        position: static;
        order: -1;
    }
}

@media (max-width: 600px) {
    body {
        padding: 1rem;
    }
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .index-grid {
        grid-template-columns: 1fr 1fr;
    }
}