
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    background-color: #f1f5f9;
    color: #1e293b;
    display: flex;
    min-height: 100vh;
}

/* Focus styles for accessibility */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* ========================================
   CSS VARIABLES (UNIFIED & DEDUPLICATED)
   ======================================== */
:root {
    /* Text & Layout */
    --text-primary: #1f2937;
    --dark-text: #1e293b;
    --light-text: #f8fafc;

    /* Primary Colors */
    --primary-blue: #3b82f6;
    --light-blue: #60a5fa;
    --primary-yellow: #f59e0b;
    --light-yellow: #fef3c7;

    /* Status Colors */
    --green-500: #10b981;
    --green-600: #059669;
    --red-500: #ef4444;
    --red-600: #dc2626;

    /* UI Elements */
    --card-bg: #ffffff;
    --sidebar-bg: #1e293b;
    --border-color: #e5e7eb;

    --text-primary: #1f2937;
    --primary-blue: #3b82f6;
    --light-blue: #60a5fa;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --modal-bg: #ffffff;
    --overlay-bg: rgba(0, 0, 0, 0.5);

    --text-primary: #1f2937;
    --primary-blue: #3b82f6;
    --light-blue: #60a5fa;
    --primary-yellow: #f59e0b;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --modal-bg: rgba(255, 255, 255, 0.95);
    --overlay-bg: rgba(15, 23, 42, 0.7);
    --success-gradient: linear-gradient(135deg, #10b981, #059669);
}

/* ========================================
   LAYOUT: SIDEBAR & MAIN
   ======================================== */
.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: var(--light-text);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.logo-icon {
    font-size: 2rem;
    color: var(--primary-yellow);
    margin-right: 10px;
}

.logo-text h1 {
    font-size: 1.4rem;
    font-weight: 600;
}

.logo-text p {
    font-size: 0.8rem;
    color: #94a3b8;
}

.nav-menu {
    flex: 1;
}

.nav-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #cbd5e1;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--light-text);
    border-left: 3px solid var(--primary-yellow);
}

.nav-item i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.top-bar {
    background: var(--card-bg);
    padding: 15px 30px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.mobile-logo {
    display: none;
    font-weight: 600;
    color: var(--primary-blue);
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.user-info {
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--light-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-weight: bold;
}

.content {
    padding: 30px;
    flex: 1;
}

footer {
    background: var(--card-bg);
    padding: 15px 30px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: #64748b;
    font-size: 0.85rem;
}

/* ========================================
   PAGE: DASHBOARD / INSTRUCTIONS
   ======================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--primary-blue);
    display: flex;
    align-items: center;
}

.page-title i {
    margin-right: 10px;
    color: var(--primary-yellow);
}

.main-stats {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* Stat Card */
.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--primary-blue);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.stat-card-title {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

.stat-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    background: var(--light-blue);
}

.stat-card-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark-text);
    margin-bottom: 5px;
}

.stat-card-desc {
    font-size: 0.9rem;
    color: #64748b;
}

/* INSTRUCTIONS CARD - FULLY RESTORED */
.instructions-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    padding: 30px;
    box-shadow:
            0 10px 30px rgba(30, 64, 175, 0.1),
            0 4px 12px rgba(0, 0, 0, 0.05);
    height: 100%;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.instructions-card:hover {
    transform: translateY(-5px);
    box-shadow:
            0 15px 35px rgba(30, 64, 175, 0.15),
            0 5px 15px rgba(0, 0, 0, 0.07);
}

.instructions-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-blue), var(--primary-yellow));
}

.instructions-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    position: relative;
}

.instructions-title i {
    margin-right: 12px;
    color: var(--primary-yellow);
    font-size: 1.6rem;
}

.steps {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.step {
    display: flex;
    gap: 18px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.9) 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.step:hover {
    transform: translateX(5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.step::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, var(--primary-blue), var(--primary-yellow));
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-blue), var(--light-blue));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
    box-shadow: 0 4px 8px rgba(30, 64, 175, 0.3);
    font-size: 0.9rem;
}

.step-content {
    flex: 1;
}

.step-content h3 {
    font-size: 1.15rem;
    color: var(--dark-text);
    margin-bottom: 8px;
    font-weight: 600;
}

.step-content p {
    color: #64748b;
    line-height: 1.6;
    font-size: 0.95rem;
}

.step-icon {
    color: var(--primary-yellow);
    font-size: 1.3rem;
    align-self: flex-start;
    margin-top: 5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ========================================
   PAGE: ACCESSORIES LIST (Count Page)
   ======================================== */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Override page-header for count page */
.page-container .page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.page-container .page-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-container .page-title i {
    font-size: 1.5rem;
    color: var(--primary-blue);
}

/* Add Button */
.btn-add {
    background: linear-gradient(to right, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-add:hover {
    background: linear-gradient(to right, #2563eb, #1e40af);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(59, 130, 246, 0.4);
    color: white;
    text-decoration: none;
}

/* Grid */
.accessories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* Card */
.accessory-card {
    background: var(--card-bg);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.accessory-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.1);
}

.accessory-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-color);
}

.accessory-content {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.accessory-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    line-height: 1.4;
}

.accessory-actions {
    margin-top: auto;
    width: 100%;
}

/* Count Button */
.btn-count {
    background: var(--green-500);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-count:hover {
    background: var(--green-600);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #6b7280;
}

.empty-state i {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 2rem;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #065f46;
    border-color: rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #7f1d1d;
    border-color: rgba(239, 68, 68, 0.2);
}

/* ========================================
   TOAST NOTIFICATIONS (TOP-RIGHT, FORCED)
   ======================================== */
#toastContainer {
    position: fixed !important;
    top: 1.5rem !important;
    right: 1.5rem !important;
    z-index: 9999 !important;
    display: flex !important;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    min-width: 280px;
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    background: var(--green-500);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
}

.toast.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

.toast.success {
    background: var(--green-500) !important;
}

.toast.error {
    background: var(--red-500) !important;
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */
@media (max-width: 992px) {
    .main-stats {
        grid-template-columns: 1fr;
    }
    .sidebar {
        width: 70px;
    }
    .logo-text,
    .nav-item span {
        display: none;
    }
    .nav-item {
        justify-content: center;
        padding: 15px 0;
    }
    .nav-item i {
        margin-right: 0;
    }
    .mobile-logo {
        display: block;
    }
    .top-bar {
        justify-content: flex-end;
        padding-left: 70px;
    }
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    .accessories-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }
    .user-info div:not(.user-avatar) {
        display: none;
    }
    .user-avatar {
        margin-right: 0;
    }
    .step {
        padding: 15px;
    }
    .instructions-card {
        padding: 20px;
    }
    #toastContainer {
        top: 1rem !important;
        right: 1rem !important;
    }
}

@media (max-width: 480px) {
    .accessories-grid {
        grid-template-columns: 1fr;
    }
    .page-container {
        padding: 1rem;
    }
    .toast {
        min-width: 240px;
        font-size: 0.85rem;
    }
}

/* === GLOWING CARD EFFECT === */
.accessory-card::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: linear-gradient(45deg, #3b82f6, #10b981, #f59e0b, #3b82f6);
    border-radius: 1.1rem;
    z-index: -1;
    opacity: 0;
    filter: blur(8px);
    transition: opacity 0.4s ease;
}

.accessory-card:hover::before {
    opacity: 0.7;
    animation: glowPulse 2s infinite ease-in-out;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* === CIRCULAR BADGE === */
.accessory-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    font-size: 0.875rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.accessory-badge i {
    font-size: 0.7rem;
    margin-right: 2px;
}

/* === BLUE CODE === */
.accessory-code {
    font-size: 0.875rem;
    color: #3b82f6;
    font-weight: 600;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.accessory-code i {
    font-size: 0.8rem;
    color: #60a5fa;
}