/* Make the header a solid bar */
.hero-container {
    background-image: none;
    background-color: #ffffff;
    height: 80px; /* Fixed height for the header */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    position: relative;
    z-index: 100;
}

/* Override nav styles for the LK page */
nav {
    position: static; /* No longer absolute */
    width: 100%;
    background-color: transparent;
    box-shadow: none;
}

/* Remove hover effects from the main page */
nav:hover {
    background-color: transparent;
    box-shadow: none;
}

/* Adjust text colors for the light background */
nav a {
    color: #333;
}

nav:hover a {
    color: #333;
}

.nav-location {
    color: #555;
    font-weight: 500;
}

/* Style the 'Личный кабинет' button */
.nav-right a {
    color: var(--accent-blue-color);
    border-color: var(--accent-blue-color);
}

.nav-right a:hover {
    background-color: var(--accent-blue-color);
    color: #ffffff;
}

nav:hover .nav-right a:hover {
    color: #ffffff;
}

nav:hover .nav-right a {
    color: var(--accent-blue-color);
}

/* Center navigation link styling for LK page */
.nav-center a {
    position: relative; /* Needed for the pseudo-element */
    color: #000; /* Black text */
    font-weight: 700; /* Bold font */
}

/* Ensure text stays black on hover */
.nav-center a:hover {
    color: #000;
}

/* Underline animation - CORRECTED */
.nav-center a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px; /* Position under the text */
    left: 50%;
    transform: translateX(-50%); /* Center the element */
    background-color: var(--accent-red-color); /* Using the variable from the main CSS */
    transition: width 0.3s ease;
}

.nav-center a:hover::after {
    width: 100%;
}

/* Body and Main Layout - Clean Style */
html, body {
    height: 100%;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body {
    display: flex;
    flex-direction: column;
}

.login-main {
    flex-grow: 1;
    display: flex;
    align-items: flex-start; /* Changed to flex-start */
    justify-content: center;
    padding: 40px 20px;
    background-color: #f4f5f7;
}

/* Form Styles - Clean & Modern Card */
.login-container {
    max-width: 500px; /* Increased width */
    width: 100%;
    padding: 40px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08);
    text-align: center;
    border: 1px solid #e8e8e8;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.login-header p {
    font-size: 16px;
    color: #555;
    line-height: 1.5;
    margin-bottom: 30px;
}

.login-form .input-group {
    margin-bottom: 25px; /* Increased margin */
    text-align: left;
}

.input-wrapper {
    position: relative;
}

.login-form input, .login-form select {
    width: 100%;
    padding: 14px 12px 14px 45px; /* Adjust padding for icon and label */
    border: 1px solid #dcdcdc;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #fff;
    appearance: none; /* Remove default select arrow */
}

.input-wrapper label {
    position: absolute;
    left: 45px; /* Align with input text */
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 16px;
    pointer-events: none;
    transition: all 0.2s ease-out;
}

.input-wrapper i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 16px;
    pointer-events: none;
}

.login-form input:focus + label,
.login-form input:not(:placeholder-shown) + label,
.login-form select:focus + label,
.login-form select:not([value=""]) + label {
    top: -10px;
    left: 10px;
    font-size: 12px;
    color: var(--accent-blue-color);
    background-color: #ffffff;
    padding: 0 5px;
}

.login-form input:focus ~ i, 
.login-form input:not(:placeholder-shown) ~ i, 
.login-form select:focus ~ i {
    color: var(--accent-blue-color);
}

.login-form input:focus, .login-form select:focus {
    outline: none;
    border-color: var(--accent-blue-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.login-button {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 5px;
    background-color: var(--accent-red-color);
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-top: 10px;
}

.login-button:hover {
    background-color: #b81010;
    transform: translateY(-2px);
}

.login-button:active {
    transform: translateY(0);
}

.register-link {
    margin-top: 25px;
    font-size: 15px;
    color: #555;
}

.register-link a {
    color: var(--accent-blue-color);
    font-weight: 600;
    text-decoration: none;
}

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

.password-group {
    display: flex;
    gap: 15px;
}

.password-wrapper {
    flex: 1;
    min-width: 0;
}

/* === CABINET STYLES START HERE === */

.logout-button-nav {
    color: var(--accent-red-color) !important;
    border-color: var(--accent-red-color) !important;
}

.logout-button-nav:hover {
    background-color: var(--accent-red-color) !important;
    color: #ffffff !important;
}

nav:hover .logout-button-nav {
    color: var(--accent-red-color) !important;
}

nav:hover .logout-button-nav:hover {
    color: #ffffff !important;
}

.cabinet-container {
    width: 100%;
    max-width: 960px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cabinet-profile {
    background-color: #ffffff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8e8e8;
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-icon {
    font-size: 40px;
    color: var(--accent-blue-color);
}

.profile-info h4 {
    margin: 0 0 5px 0;
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

.profile-info p {
    margin: 0;
    font-size: 16px;
    color: #555;
}

.cabinet-stats-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stat-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.stat-block {
    background-color: #ffffff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8e8e8;
    text-align: left;
    display: flex;
    flex-direction: column; /* Ensure content stacks vertically */
    justify-content: space-between; /* Pushes content apart */
}

.stat-block h5 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #555;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-block h5 i {
    color: var(--accent-blue-color);
    font-size: 18px;
}

.stat-block p {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-red-color);
}


/* === NEW ACTION BLOCKS & MODAL FORM STYLES === */

.cabinet-actions-grid {
    display: grid;
    grid-template-columns: 1fr; /* Single column */
    gap: 20px;
}

.action-block-full-width {
    grid-column: 1 / -1; /* Span across all columns */
    padding: 30px 25px; /* More padding for a larger touch target */
}

.action-block.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.action-block.disabled:hover {
    background-color: #ffffff;
    transform: none;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08);
}


.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: block;
    border: 1px solid #dcdcdc;
    border-radius: 5px;
    padding-left: 45px; /* For icon */
}

.file-input {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.file-label {
    display: inline-block;
    background-color: #e9ecef;
    color: #495057;
    padding: 14px 20px;
    border-right: 1px solid #dcdcdc;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

.file-input:hover + .file-label {
    background-color: #dee2e6;
}

.file-name {
    display: inline-block;
    padding: 14px 15px;
    font-size: 16px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}


/* === MODAL STYLES START HERE === */

.modal-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    position: relative;
    background-color: #ffffff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #aaa;
    font-size: 30px;
    font-weight: bold;
    border: none;
    background: none;
    cursor: pointer;
}

.modal-close:hover,
.modal-close:focus {
    color: black;
    text-decoration: none;
}

.form-separator {
    font-weight: bold;
    margin-top: 30px;
    margin-bottom: 20px;
    text-align: center;
    color: #555;
}

/* === MODAL STYLES END HERE === */

/* --- Refill Counter & Cashback Promo Styles --- */
.refill-counter {
    display: flex;
    align-items: baseline;
    gap: 15px;
}

.refill-counter p {
    margin: 0;
}

.cashback-promo {
    font-size: 0.9rem;
    font-weight: 500;
    color: #555;
    margin-left: auto; /* Pushes the promo text to the right */
}


.stat-block.cashback-achieved .cashback-promo {
    color: #28a745; /* Green color to match the theme */
    font-weight: 600;
}

/* --- File Preview Styles for Multi-upload --- */
#file-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e8e8e8;
}

.preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    transition: background-color 0.2s;
}

.preview-remove-btn:hover {
    background-color: rgba(220, 53, 69, 0.9);
}


/* === HISTORY TABLE & PAGINATION STYLES === */
.cabinet-history {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8e8e8;
}

.cabinet-history h3 {
    font-size: 22px;
    font-weight: 700;
    color: #333;
    margin: 0 0 25px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.history-table-container {
    width: 100%;
    overflow-x: auto; /* For responsiveness */
}

.lk-table-history {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 15px;
}

.lk-table-history thead {
    border-bottom: 2px solid #e8e8e8;
}

.lk-table-history th {
    padding: 12px 15px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lk-table-history tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.lk-table-history tbody tr:last-child {
    border-bottom: none;
}

.lk-table-history tbody tr:hover {
    background-color: #f8f9fa;
}

.lk-table-history td {
    padding: 15px;
    color: #333;
    vertical-align: middle;
}

.no-requests {
    text-align: center;
    padding: 40px 15px !important;
    color: #777;
    font-size: 16px;
}

.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: 600;
    font-size: 13px;
    text-transform: capitalize;
    white-space: nowrap;
}

.status-pending {
    background-color: #fff0c2;
    color: #8c6c0a;
}

.status-approved {
    background-color: #c8e6c9;
    color: #256029;
}

.status-rejected {
    background-color: #ffcdd2;
    color: #c62828;
}

.pagination {
    margin-top: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.page-link {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: #fff;
    border: 1px solid #dcdcdc;
    color: #555;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.page-link:hover {
    background-color: #f0f0f0;
    border-color: #bbb;
}

.page-link.active {
    background-color: var(--accent-red-color);
    border-color: var(--accent-red-color);
    color: #fff;
    cursor: default;
}

/* === RESPONSIVE STYLES === */

@media (max-width: 768px) {
    .stat-row {
        grid-template-columns: 1fr;
    }

    .cabinet-actions-grid {
        grid-template-columns: 1fr;
    }

    .password-group {
        flex-direction: column;
    }

    .nav-center ul {
        display: none; /* Hide for simplicity on mobile, can be replaced with a hamburger menu */
    }

    .nav-location {
        display: none;
    }

    /* Responsive Table Styles */
    .lk-table-history thead {
        display: none; /* Hide table header */
    }

    .lk-table-history, .lk-table-history tbody, .lk-table-history tr, .lk-table-history td {
        display: block;
        width: 100%;
    }

    .lk-table-history tr {
        margin-bottom: 15px;
        border: 1px solid #e8e8e8;
        border-radius: 8px;
        padding: 10px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    }
    .lk-table-history tbody tr:hover {
        background-color: #fff; /* Disable hover on mobile view */
    }

    .lk-table-history td {
        padding: 10px 5px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none;
        border-bottom: 1px dashed #eee;
        text-align: right; /* Align value to the right */
    }

    .lk-table-history td:last-child {
        border-bottom: none;
    }

    .lk-table-history td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #555;
        text-align: left; /* Align label to the left */
        padding-right: 15px;
    }
}

@media (max-width: 480px) {
    .login-container, .cabinet-profile, .stat-block, .modal-content, .cabinet-history {
        padding: 20px;
    }

    .login-header h1 {
        font-size: 24px;
    }
    .profile-info h4 {
        font-size: 18px;
    }
    .stat-block p {
        font-size: 28px;
    }
}
