* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark-color);
}

/* Login Page Styles */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-box {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.login-header i {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-header p {
    font-size: 14px;
    opacity: 0.9;
}

.form-container {
    padding: 40px 30px;
}

.form-container h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 25px;
    color: var(--dark-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark-color);
    font-size: 14px;
}

.form-group label i {
    margin-right: 5px;
    color: var(--secondary-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn i {
    font-size: 16px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.error-message {
    color: var(--danger-color);
    font-size: 13px;
    margin-bottom: 15px;
    padding: 10px;
    background: #fef2f2;
    border-radius: 6px;
    border-left: 4px solid var(--danger-color);
    display: none;
}

.error-message.show {
    display: block;
}

.success-message {
    color: var(--success-color);
    font-size: 13px;
    margin-bottom: 15px;
    padding: 10px;
    background: #f0fdf4;
    border-radius: 6px;
    border-left: 4px solid var(--success-color);
    display: none;
}

.success-message.show {
    display: block;
}

.form-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.form-footer p {
    font-size: 14px;
    color: var(--secondary-color);
}

.form-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.form-footer a:hover {
    text-decoration: underline;
}

/* Dashboard Styles */
.dashboard {
    background: var(--light-color);
}

.navbar {
    background: white;
    box-shadow: var(--shadow);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--dark-color);
    text-decoration: none;
}

.navbar-brand img {
    flex-shrink: 0;
    max-height: 35px;
    width: auto;
}

.navbar-brand span {
    font-weight: 700;
}

.navbar-menu {
    display: flex;
    gap: 5px;
    list-style: none;
    align-items: center;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--primary-color);
    cursor: pointer;
    padding: 8px;
}

.navbar-menu a {
    padding: 10px 18px;
    color: var(--dark-color);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 14px;
}

.navbar-menu a:hover {
    background: var(--light-color);
    color: var(--primary-color);
}

.navbar-menu a.active {
    background: var(--primary-color);
    color: white;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-left: 20px;
    border-left: 2px solid var(--border-color);
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--dark-color);
}

.user-role {
    font-size: 12px;
    color: var(--secondary-color);
}

.btn-logout {
    padding: 8px 16px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: #dc2626;
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 8px;
}

.page-header p {
    color: var(--secondary-color);
    font-size: 15px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-icon.blue {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.stat-icon.green {
    background: linear-gradient(135deg, #10b981, #059669);
}

.stat-icon.orange {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.stat-icon.red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 4px;
}

.stat-info p {
    color: var(--secondary-color);
    font-size: 14px;
    font-weight: 500;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 25px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.card-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--dark-color);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: var(--light-color);
}

table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--dark-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

table tbody tr:hover {
    background: var(--light-color);
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background: #e2e8f0;
    color: #475569;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-icon {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    transform: scale(1.05);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 25px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--dark-color);
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--secondary-color);
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.btn-close:hover {
    background: var(--light-color);
    color: var(--danger-color);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 2px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.alert i {
    font-size: 20px;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning-color);
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid var(--primary-color);
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--secondary-color);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--dark-color);
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* Loading */
.loading {
    display: none;
    text-align: center;
    padding: 40px;
}

.loading.show {
    display: block;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Filters */
.filters {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .navbar-container {
        height: auto;
        padding: 12px 15px;
        flex-wrap: wrap;
    }

    .navbar-brand {
        font-size: 15px;
        flex: 1;
    }

    .navbar-brand img {
        max-height: 28px !important;
    }
    
    .navbar-brand span {
        font-size: 14px;
    }

    .menu-toggle {
        display: block;
        order: 2;
    }

    .navbar-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        order: 3;
        margin: 15px 0 0 0;
        gap: 8px;
        background: var(--light-color);
        padding: 15px;
        border-radius: 12px;
    }

    .navbar-menu.show {
        display: flex;
    }

    .navbar-menu li {
        width: 100%;
    }

    .navbar-menu a {
        width: 100%;
        padding: 12px 15px;
        font-size: 14px;
        justify-content: flex-start;
        border-radius: 8px;
    }

    .navbar-menu a i {
        display: inline-block;
        width: 24px;
    }

    .navbar-user {
        display: none;
        border: none;
        padding: 0;
        width: 100%;
        order: 4;
        margin-top: 10px;
        background: var(--light-color);
        padding: 15px;
        border-radius: 12px;
        gap: 12px;
    }

    .navbar-user.show {
        display: flex;
    }

    .user-info {
        text-align: left;
        flex: 1;
    }

    .user-name {
        font-size: 14px;
    }

    .user-role {
        font-size: 12px;
    }

    .btn-logout {
        padding: 10px 20px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* Main Content */
    .main-content {
        padding: 15px 12px;
    }

    .page-header {
        margin-bottom: 20px;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .page-header h1 i {
        font-size: 20px;
    }

    .page-header p {
        font-size: 13px;
        margin-top: 5px;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 15px;
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .stat-icon {
        width: 45px;
        height: 45px;
        font-size: 18px;
        margin: 0 auto;
    }

    .stat-info h3 {
        font-size: 22px;
    }

    .stat-info p {
        font-size: 12px;
    }

    /* Cards */
    .card {
        padding: 15px;
        margin-bottom: 15px;
    }

    .card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding-bottom: 12px;
    }

    .card-header h2 {
        font-size: 16px;
    }

    .card-header .btn {
        width: 100%;
        justify-content: center;
    }
    
    .card-header > div {
        flex-direction: column;
        width: 100%;
    }
    
    .card-header > div .btn {
        width: 100%;
    }

    /* Tables */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -15px;
        padding: 0 15px;
    }

    table {
        font-size: 11px;
        min-width: 100%;
    }

    table th,
    table td {
        padding: 8px 6px;
        white-space: nowrap;
        font-size: 11px;
    }

    table th {
        font-size: 10px;
        letter-spacing: 0;
    }

    /* Mobile table simplification */
    .hide-mobile {
        display: none !important;
    }
    
    table tbody tr {
        border-bottom: 2px solid var(--border-color);
    }

    /* Form Elements */
    .form-row {
        grid-template-columns: 1fr;
    }

    .form-group label {
        font-size: 13px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 14px;
        padding: 10px 12px;
    }

    /* Filters */
    .filters {
        padding: 12px;
    }

    .filters-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Buttons */
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .btn i {
        font-size: 13px;
    }

    .btn-icon {
        padding: 10px;
        font-size: 16px;
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .action-buttons {
        gap: 8px;
        justify-content: center;
    }
    
    /* Larger touch targets for mobile */
    input[type="checkbox"],
    input[type="radio"] {
        min-width: 20px;
        min-height: 20px;
    }

    /* Modal */
    .modal {
        padding: 0;
        align-items: flex-end;
    }

    .modal-content {
        max-width: 100%;
        max-height: 90vh;
        border-radius: 20px 20px 0 0;
        margin: 0;
    }

    .modal-header {
        padding: 18px 15px;
    }

    .modal-header h2 {
        font-size: 17px;
    }

    .modal-body {
        padding: 15px;
        max-height: calc(90vh - 140px);
        overflow-y: auto;
    }

    .modal-footer {
        padding: 12px 15px;
        flex-direction: column-reverse;
        gap: 8px;
    }

    .modal-footer .btn {
        width: 100%;
    }

    /* Badges */
    .badge {
        font-size: 10px;
        padding: 4px 8px;
    }

    .badge i {
        font-size: 9px;
    }

    /* Alerts */
    .alert {
        padding: 12px 15px;
        font-size: 13px;
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .alert i {
        font-size: 18px;
    }

    /* Empty State */
    .empty-state {
        padding: 40px 15px;
    }

    .empty-state i {
        font-size: 48px;
    }

    .empty-state h3 {
        font-size: 18px;
    }

    .empty-state p {
        font-size: 13px;
    }

    /* Login Page */
    .login-container {
        padding: 0 10px;
    }

    .login-header {
        padding: 30px 20px;
    }

    .login-header i {
        font-size: 40px;
    }

    .login-header h1 {
        font-size: 24px;
    }

    .login-header p {
        font-size: 13px;
    }

    .form-container {
        padding: 30px 20px;
    }

    .form-container h2 {
        font-size: 20px;
    }

    /* Charts - Reports */
    .filters-row > div:nth-last-child(-n+2) {
        order: 10;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-container {
        padding: 25px 18px;
    }

    .login-header {
        padding: 25px 18px;
    }
    
    .login-header svg {
        width: 50px;
        height: 50px;
    }

    /* Simplify alerts for small screens */
    .alert {
        font-size: 12px;
        padding: 10px 12px;
    }

    /* Better spacing for two-line content */
    table td small {
        display: block;
        margin-top: 3px;
        line-height: 1.3;
    }
    
    /* Improve readability */
    table td strong {
        font-size: 12px;
    }
}

/* Purchases Module - Blinking Animations */
@keyframes blink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0.3;
    }
}

@keyframes blink-slow {
    0%, 70% {
        opacity: 1;
    }
    71%, 100% {
        opacity: 0.5;
    }
}

/* Blinking badge for pending status */
.badge.blink {
    animation: blink 1.5s infinite;
}

/* Slower blink for purchased status */
.badge.blink-slow {
    animation: blink-slow 2s infinite;
}

/* Purchased badge color */
.badge-purchased {
    background-color: #dbeafe;
    color: #1e40af;
    border: 2px solid #3b82f6;
}

/* Delay badge with blinking */
.badge-delay {
    background-color: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
    font-weight: 700;
    padding: 6px 10px;
    font-size: 11px;
    letter-spacing: 0.5px;
}

/* Info box styles */
.info-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.info-box p {
    margin: 0;
    line-height: 1.8;
}

.info-box strong {
    color: var(--dark-color);
    font-weight: 600;
}
