:root {
    --primary-color: #92224A; /* Common color for RAK Government */
    --primary-hover: #7a1c3d;
    --secondary-color: #28a745; /* Success Green */
    --text-dark: #333;
    --text-light: #666;
    --bg-light: #f9f9f9;
    --border-color: #ddd;
}

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

body {
    font-family: 'Cairo', sans-serif;
    background-color: #fff;
    color: var(--text-dark);
    height: 100vh;
    overflow: hidden;
}

.login-container {
    display: flex;
    height: 100vh;
}

/* Right Side - Form */
.login-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem 4rem;
    overflow-y: auto;
    background: #fff;
}

.logos {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.logo {
    height: 60px;
    object-fit: contain;
}

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

.login-form-container h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #1a1a1a;
}

.subtitle {
    color: var(--text-light);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* UAE Pass Section */
.uae-pass-section {
    margin-bottom: 2rem;
    text-align: center;
}

.uae-pass-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    max-width: 250px;
    transition: transform 0.2s ease;
}

.uae-pass-btn:hover {
    transform: scale(1.02);
}

.uae-pass-btn img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-light);
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider span {
    padding: 0 1rem;
    font-size: 0.9rem;
}

/* Form Styles */
.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(146, 34, 74, 0.1);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.forgot-password {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.forgot-password:hover {
    text-decoration: underline;
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
}

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

.submit-btn:active {
    transform: scale(0.98);
}

.signup-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.95rem;
}

.signup-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 700;
}

.signup-link a:hover {
    text-decoration: underline;
}

/* Left Side - Image */
.login-left {
    flex: 1.2;
    background-image: url('../img/login-customer.jpg.jpeg');
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: flex-end;
}

.overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.2) 100%);
    display: flex;
    align-items: flex-end;
    padding: 4rem;
}

.left-content {
    color: #fff;
    max-width: 600px;
}

.left-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.left-content p {
    font-size: 1.2rem;
    line-height: 1.6;
    opacity: 0.9;
}

/* Responsive */
@media (max-width: 992px) {
    .login-left {
        display: none;
    }
    .login-right {
        padding: 2rem;
    }
    .login-form-container {
        margin-top: 2rem;
    }
}

/* ========================================================
   DASHBOARD STYLES
   ======================================================== */

.dashboard-body {
    background-color: var(--bg-light);
    height: 100vh;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 700;
}

.dashboard-wrapper {
    display: none; /* Shown after JWT verification */
    height: 100vh;
    display: flex; /* Will be set to flex via JS instead of block but we handle it via JS display block to wrapper */
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: #fff;
    border-left: 1px solid var(--border-color); /* RTL */
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 5px rgba(0,0,0,0.05);
    z-index: 10;
}

.sidebar-header {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    color: var(--primary-color);
    font-size: 1.4rem;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
    flex: 1;
}

.sidebar-menu li {
    padding: 0 1rem;
    margin-bottom: 0.5rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    color: var(--text-light);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background-color: rgba(146, 34, 74, 0.08);
    color: var(--primary-color);
}

.sidebar-menu .icon {
    margin-left: 10px;
    font-size: 1.2rem;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.logout-btn {
    width: 100%;
    padding: 0.8rem;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.logout-btn:hover {
    background-color: #f5c6cb;
}

.logout-navbar-btn {
    display: none;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Navbar */
.navbar {
    height: 70px;
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-logo {
    height: 45px;
    object-fit: contain;
}

.nav-right {
    display: flex;
    align-items: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.user-profile:hover {
    background-color: #f0f0f0;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

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

/* Dashboard Content */
.content-area {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.welcome-card {
    background-color: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border-right: 4px solid var(--primary-color);
}

.welcome-card h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: #1a1a1a;
}

.welcome-card p {
    color: var(--text-light);
    font-size: 1.1rem;
}

/* Table Card Styles */
.table-card {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.table-header {
    background-color: #f8f9fa;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.table-header h2 {
    font-size: 1.4rem;
    color: var(--text-dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-header h2 i {
    color: var(--primary-color);
}

.table-wrapper {
    width: 100%;
}

.licenses-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
}

.licenses-table th {
    background-color: #fff;
    position: sticky;
    top: 0; /* Keeps header fixed while scrolling */
    z-index: 2;
    padding: 1rem 2rem;
    font-weight: 700;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border-color);
    box-shadow: 0 2px 2px -1px rgba(0,0,0,0.1);
}

.licenses-table td {
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 0.95rem;
}

.licenses-table tbody tr {
    transition: background-color 0.2s;
}

.licenses-table tbody tr:hover {
    background-color: rgba(146, 34, 74, 0.03); /* Subtle primary color on hover */
}

/* PDF Button styling */
.pdf-btn {
    background-color: #f1f3f5;
    color: var(--text-dark);
    border: 1px solid #ced4da;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pdf-btn i {
    color: #dc3545; /* PDF Red icon */
    font-size: 1.1rem;
}

.pdf-btn:hover {
    background-color: #e2e6ea;
    border-color: #dae0e5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.pdf-btn:active {
    transform: translateY(1px);
}

/* Delete Button styling */
.delete-btn {
    background-color: #ffeaea;
    color: #dc3545;
    border: 1px solid #ffc1c7;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.delete-btn:hover {
    background-color: #dc3545;
    color: #fff;
    border-color: #dc3545;
    box-shadow: 0 2px 4px rgba(220,53,69,0.2);
}

.delete-btn:active {
    transform: translateY(1px);
}

/* Upload UI Styles */
.upload-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.upload-label {
    border: 2px dashed var(--primary-color);
    background-color: rgba(146, 34, 74, 0.05);
    padding: 3rem 2rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.upload-label:hover {
    background-color: rgba(146, 34, 74, 0.1);
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary-color);
}

.upload-label span {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.file-name {
    text-align: center;
    font-weight: 600;
    color: var(--secondary-color); /* Success Green from variables */
    word-break: break-all;
    overflow-wrap: break-word;
    max-width: 100%;
    padding: 0 10px;
}

/* Dashboard Responsive Styles */
@media (max-width: 992px) {
    .dashboard-wrapper {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 65px;
        background-color: #fff;
        border-top: 1px solid var(--border-color);
        border-bottom: none;
        border-left: none;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        box-shadow: 0 -3px 10px rgba(0,0,0,0.05);
        z-index: 1000;
    }

    .sidebar-header {
        display: none;
    }
    
    .sidebar-menu {
        display: flex;
        flex-direction: row;
        width: 100%;
        height: 100%;
        padding: 0;
        margin: 0;
        justify-content: space-around;
        align-items: center;
    }
    
    .sidebar-menu li {
        flex: 1;
        height: 100%;
        margin: 0;
        padding: 0;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .sidebar-menu a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        padding: 0.2rem 0;
        gap: 4px;
        font-size: 0.8rem;
        border-radius: 0;
        color: var(--text-light);
    }

    .sidebar-menu a:hover, .sidebar-menu a.active {
        background-color: transparent;
        color: var(--primary-color);
    }
    
    .sidebar-menu .icon {
        margin: 0;
        font-size: 1.3rem;
    }
    
    .sidebar-footer {
        display: none;
    }

    .navbar {
        padding: 0 1rem;
    }

    .nav-logo {
        height: 35px;
    }
    
    .nav-right {
        gap: 12px;
    }

    .logout-navbar-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border-radius: 50%;
        background-color: #f8d7da;
        color: #721c24;
        border: 1px solid #f5c6cb;
        font-size: 1.05rem;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .logout-navbar-btn:hover {
        background-color: #f5c6cb;
    }
    
    .user-name {
        display: none; /* Hide name on small screens, show only avatar */
    }
    
    .content-area {
        padding: 1rem;
        padding-bottom: 80px; /* Space for the bottom navigation bar */
    }
    
    /* Make table horizontally scrollable */
    .table-wrapper {
        overflow-x: auto;
    }
    
    .licenses-table {
        min-width: 600px; /* Force minimum width to prevent collapsing text */
    }
}

@media (max-width: 480px) {
    .welcome-card h1 {
        font-size: 1.4rem;
    }
    
    .nav-left {
        gap: 0.5rem;
    }
    
    .table-header {
        padding: 1rem;
    }
}

/* Pagination Footer Styles */
.pagination-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: #f8f9fa;
    border-top: 1px solid var(--border-color);
}

.page-nav-btn {
    background-color: #fff;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.page-nav-btn:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 2px 5px rgba(146, 34, 74, 0.2);
}

.page-nav-btn:disabled {
    color: #ccc;
    border-color: #eee;
    background-color: #fafafa;
    cursor: not-allowed;
}

.page-indicator {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-light);
}

/* Responsive Create Card Spacing */
.create-card {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.preview-area {
    width: 100%;
    max-width: 600px;
    margin: 1.5rem auto 0 auto;
}

@media (max-width: 576px) {
    .create-card {
        padding: 1.2rem;
        gap: 1rem;
    }
    .upload-label {
        padding: 2rem 1rem;
        width: 100%;
    }
    .upload-label span {
        font-size: 0.95rem;
    }
    .welcome-card {
        padding: 1.2rem;
    }
    .welcome-card h1 {
        font-size: 1.4rem;
    }
    .welcome-card p {
        font-size: 0.95rem;
    }
    #previewBtn, #pdfOpenLink {
        width: 100% !important;
        max-width: 100% !important;
    }
    .pagination-footer {
        padding: 0.8rem 0.5rem;
        gap: 0.5rem;
    }
    .page-nav-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    .page-indicator {
        font-size: 0.85rem;
    }
}
