/* Hide all cards by default for special terminal layouts */
.card.ext-pos, .card.topup, .vendor-section, .organiser-section {
    display: none !important;
}

/* Show only Vendor POS Login (external vendor) on 1920x1080 terminals */
@media (min-width: 1800px) and (max-width: 1920px) and (min-height: 1000px) and (max-height: 1080px) {
    .vendor-section {
        display: grid !important;
    }
    .organiser-section {
        display: grid !important;
    }
    .card.ext-pos,
    .card.org-pos,
    .card.topup,
    .card.kiosk,
    .card.admin,
    .card.report,
    .card.mobile {
        display: flex !important;
    }
}

/* Show only Top-Up Login (from organiser) on 800x1280 portrait terminals */
@media (max-width: 900px) and (min-height: 1200px),
       (max-width: 820px) and (orientation: portrait),
       (max-height: 900px) and (min-width: 1200px) and (orientation: portrait),
       (max-width: 820px) and (min-height: 1260px),
       (width: 800px) and (height: 1280px),
       screen and (device-width: 800px) and (device-height: 1280px) {
    .organiser-section {
        display: grid !important;
    }
    .card.topup {
        display: flex !important;
    }
    /* Hide vendor section completely */
    .vendor-section {
        display: none !important;
    }
    /* Ascunde celelalte carduri din organiser */
    .organiser-section .card:not(.topup) {
        display: none !important;
    }
}
  :root {
            --primary: #3a86ff;
            --primary-dark: #2667cc;
            --secondary: #8338ec;
            --warning: #ffbe0b;
            --danger: #ff006e;
            --success: #06d6a0;
            --light: #121212;
            --dark: #e9ecef;
            --gray: #6c757d;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        
        body {
            background: linear-gradient(135deg, #121212 0%, #1e1e1e 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }
        
        .container {
            width: 100%;
            max-width: 1900px; /* Use almost full screen width */
        }
        
        .header {
            text-align: center;
            margin-bottom: 20px; /* Reduced from 40px */
        }
        
        .header h1 {
            color: var(--dark);
            font-size: 2.2rem; /* Slightly smaller */
            margin-bottom: 8px; /* Reduced from 10px */
        }
        
        .header p {
            color: #aaa;
            font-size: 1rem; /* Slightly smaller */
        }
        
        .cards-container {
            display: grid;
            grid-template-columns: repeat(4, 1fr); /* 4 columns for better fit */
            gap: 20px;
            max-width: 1880px;
            margin: 0 auto;
        }
        
        /* Special layout for POS terminal - 2 rows */
        .vendor-section {
            grid-column: 1 / -1; /* Full width for vendor section */
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 20px;
            margin-bottom: 30px;
        }
        
        .organiser-section {
            grid-column: 1 / -1; /* Full width for organiser section */
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 20px;
        }
        
        .section-header {
            grid-column: 1 / -1;
            text-align: center;
            margin: 15px 0 10px 0; /* Reduced margins */
            padding: 10px 0; /* Reduced padding */
            border-bottom: 2px solid #333;
        }
        
        .section-header h2 {
            color: var(--dark);
            font-size: 1.2rem; /* Slightly smaller */
            font-weight: 600;
            margin: 0;
            letter-spacing: 1px;
        }
        
        .card {
            background: #1e1e1e;
            border: 1px solid #333;
            border-radius: 10px;
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
            overflow: hidden;
            transition: transform 0.3s ease;
            display: flex;
            flex-direction: column;
        }
        
        .card:hover {
            transform: translateY(-5px);
        }
        
        .card-header {
            padding: 15px; /* Reduced from 20px */
            background: var(--primary);
            color: white;
            text-align: center;
        }
        
        .card-header h2 {
            font-size: 1.3rem; /* Reduced from 1.5rem */
            margin: 0;
        }
        
        .card-body {
            padding: 15px; /* Reduced from 20px */
            flex-grow: 1;
            display: flex;
            flex-direction: column;
        }
        
        .card-icon {
            width: 50px; /* Reduced from 60px */
            height: 50px; /* Reduced from 60px */
            margin: 0 auto 15px; /* Reduced margin */
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            background: var(--primary-dark);
            border-radius: 50%;
            font-size: 1.3rem; /* Reduced from 1.5rem */
        }
        
        .card-description {
            color: var(--gray);
            margin-bottom: 15px; /* Reduced from 20px */
            line-height: 1.4; /* Reduced from 1.6 */
            flex-grow: 1;
            text-align: justify;
            font-size: 0.9rem; /* Slightly smaller text */
        }
        
        .card-footer {
            padding: 0 15px 15px; /* Reduced padding */
            text-align: center;
        }
        
        .btn {
            display: inline-block;
            padding: 15px 25px; /* Increased height from 10px to 15px */
            background: var(--primary);
            color: white;
            text-decoration: none;
            border-radius: 50px;
            font-weight: 600;
            transition: background 0.3s ease;
            border: none;
            cursor: pointer;
            width: 100%;
            max-width: 180px; /* Reduced from 200px */
            font-size: 1rem; /* Increased from 0.9rem */
            min-height: 50px; /* Added minimum height */
        }
        
        .btn:hover {
            background: var(--primary-dark);
        }
        
        .org-pos .card-header {
            background: var(--success);
        }
        
        .org-pos .card-icon,
        .org-pos .btn {
            background: #06b48a;
        }
        
        .org-pos .btn:hover {
            background: #059b78;
        }

        .ext-pos .card-header {
            background: #2196F3;
        }
        
        .ext-pos .card-icon,
        .ext-pos .btn {
            background: #1976D2;
        }
        
        .ext-pos .btn:hover {
            background: #1565C0;
        }
        
        .topup .card-header {
            background: var(--warning);
        }
        
        .topup .card-icon,
        .topup .btn {
            background: #e6ac00;
        }
        
        .topup .btn:hover {
            background: #cc9900;
        }
        
        .kiosk .card-header {
            background: var(--secondary);
        }
        
        .kiosk .card-icon,
        .kiosk .btn {
            background: #732ecf;
        }
        
        .kiosk .btn:hover {
            background: #6628b9;
        }
        
        .admin .card-header {
            background: var(--danger);
        }
        
        .admin .card-icon,
        .admin .btn {
            background: #e60063;
        }
        
        .admin .btn:hover {
            background: #cc0057;
        }
        
        .report .card-header {
            background: var(--gray);
        }
        
        .report .card-icon,
        .report .btn {
            background: #5a6268;
        }
        
        .report .btn:hover {
            background: #495057;
        }

        .mobile .card-header {
            background: #9c27b0;
        }
        
        .mobile .card-icon,
        .mobile .btn {
            background: #7b1fa2;
        }
        
        .mobile .btn:hover {
            background: #6a1b9a;
        }

        /* Modal buttons will be styled dynamically based on card type */
        #submitBtn:hover {
            opacity: 0.9;
        }
        
        /* POS Terminal Optimizations for 1920x1080 */
        @media (min-width: 1800px) and (max-width: 1920px) {
            body {
                padding: 10px; /* Minimal padding for terminals */
                align-items: flex-start; /* Remove vertical centering gap */
                padding-top: 20px; /* Small top padding instead of centering */
            }
            
            .container {
                max-width: 1900px;
            }
            
            .header {
                margin-bottom: 15px;
            }
            
            .cards-container {
                gap: 12px; /* Even tighter for large screens */
            }
            
            .card {
                max-height: 400px; /* Limit card height */
            }
        }
        
        /* Portrait Terminal Optimizations for 800x1280 - More comprehensive detection */
        @media (max-width: 900px) and (min-height: 1200px),
               (max-width: 820px) and (orientation: portrait),
               (max-height: 900px) and (min-width: 1200px) and (orientation: portrait) {
            body {
                padding: 15px 10px;
                align-items: flex-start;
            }
            
            .container {
                max-width: 780px;
                width: 100%;
            }
            
            .header {
                margin-bottom: 25px;
            }
            
            .header h1 {
                font-size: 1.8rem;
                margin-bottom: 6px;
            }
            
            .header p {
                font-size: 0.9rem;
            }
            
            .cards-container {
                grid-template-columns: 1fr !important; /* Single column layout - force override */
                gap: 15px;
                max-width: 100%;
            }
            
            /* Section styling for portrait */
            .vendor-section,
            .organiser-section {
                display: grid !important;
                grid-template-columns: 1fr !important; /* Single column - force override */
                gap: 15px;
                margin-bottom: 25px;
            }
            
            .section-header {
                margin: 10px 0 15px 0;
                padding: 8px 0;
            }
            
            .section-header h2 {
                font-size: 1.1rem;
            }
            
            /* Card optimizations for portrait */
            .card {
                max-width: 100% !important;
                min-height: 160px;
            }
            
            .card-header {
                padding: 12px;
            }
            
            .card-header h2 {
                font-size: 1.2rem;
            }
            
            .card-body {
                padding: 12px;
            }
            
            .card-icon {
                width: 45px;
                height: 45px;
                margin: 0 auto 12px;
                font-size: 1.2rem;
            }
            
            .card-description {
                font-size: 0.85rem;
                line-height: 1.3;
                margin-bottom: 12px;
            }
            
            .card-footer {
                padding: 0 12px 12px;
            }
            
            .btn {
                padding: 12px 20px; /* Increased from 8px to 12px */
                font-size: 0.95rem; /* Increased from 0.85rem */
                max-width: 160px;
                min-height: 45px; /* Added minimum height for portrait */
            }
            
            /* Modal adjustments for portrait */
            .modal-content {
                margin: 10% auto;
                max-width: 350px;
                padding: 20px;
            }
        }
        
        /* Exact 800x1280 portrait terminals - Multiple detection methods */
        @media (max-width: 820px) and (min-height: 1260px),
               (width: 800px) and (height: 1280px),
               screen and (device-width: 800px) and (device-height: 1280px) {
            body {
                padding: 10px 8px !important;
            }
            
            .container {
                max-width: 784px !important; /* Use almost full width */
            }
            
            .header {
                margin-bottom: 20px;
            }
            
            .cards-container {
                gap: 12px;
                grid-template-columns: 1fr !important;
            }
            
            .vendor-section,
            .organiser-section {
                grid-template-columns: 1fr !important;
            }
            
            .section-header {
                margin: 8px 0 12px 0;
                padding: 6px 0;
            }
            
            .card {
                min-height: 150px !important; /* Slightly more compact */
            }
            
            .card-description {
                font-size: 0.8rem;
                line-height: 1.25;
            }
        }
        
        /* Fallback for any narrow screen - catch all */
        @media (max-width: 850px) {
            .cards-container {
                grid-template-columns: 1fr !important;
            }
            
            .vendor-section,
            .organiser-section {
                grid-template-columns: 1fr !important;
            }
        }
        
        @media (max-width: 768px) {
            .cards-container {
                grid-template-columns: 1fr;
            }
            
            .header h1 {
                font-size: 2rem;
            }
        }
         .modal {
            display: none;
            position: fixed;
            z-index: 100;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.5);
        }
        .modal-content {
            background-color: #1e1e1e;
            border: 1px solid #333;
            margin: 15% auto;
            padding: 25px;
            border-radius: 8px;
            width: 100%;
            max-width: 400px;
            box-shadow: 0 4px 8px rgba(0,0,0,0.2);
        }
        .modal-header {
            margin-bottom: 20px;
        }
        .modal-header h3 {
            margin: 0;
            color: var(--dark);
        }
        .input-group {
            margin-bottom: 20px;
        }
        .input-group input {
            width: 100%;
            padding: 12px;
            background: #333;
                color: #fff;
                border: 1px solid #444;
            border-radius: 4px;
            font-size: 16px;
        }
        .modal-actions {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
        }
        #cancelBtn {
            background: #333;
            color: #fff;
            border: 1px solid #444;
        }
        #cancelBtn:hover {
            background: #e0e0e0;
        }
        .modal-body {
            margin-bottom: 20px;
        }
        #okBtn {
            background: var(--success);
            margin-top: 20px;
        }
        #okBtn:hover {
            background: #06b48a;
        }