/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2271b1;
    --primary-dark: #135e96;
    --primary-light: #72aee6;
    --success-color: #00a32a;
    --error-color: #d63638;
    --warning-color: #dba617;
    --info-color: #2271b1;
    --text-color: #3c434a;
    --text-light: #646970;
    --bg-color: #f0f0f1;
    --bg-white: #ffffff;
    --border-color: #c3c4c7;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 14px;
    width: 100%;
    max-width: 100%;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.app-header {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-top-menu {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 5px 20px;
    min-height: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.header-top-menu .header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-top-menu .header-right {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
}

.header-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
}

.logo {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.logo-top {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

/* Header logo: fixed space so any size image fits */
.header-logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 200px;
    height: 40px;
    flex-shrink: 0;
    overflow: hidden;
}

.header-logo-wrap-top {
    width: 150px;
    height: 30px;
}

.header-logo-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    display: block;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    margin-right: auto;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: var(--transition);
}

.main-nav {
    display: flex;
    gap: 10px;
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: var(--transition);
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Notifications */
.notifications-container {
    position: relative;
    margin-right: 15px;
}

.notification-bell {
    position: relative;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: white;
    font-size: 20px;
}

.notification-bell:hover {
    background: rgba(255, 255, 255, 0.3);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--error-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid var(--primary-color);
}

.notification-badge.hidden {
    display: none;
}

.notifications-dropdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 350px;
    max-height: 500px;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    overflow: hidden;
    color: rgba(0, 0, 0, 1);
}

.notifications-dropdown.hidden {
    display: none;
}

.notifications-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-color);
}

.notifications-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.notification-item:hover {
    background: var(--bg-color);
}

.notification-item.unread {
    background: #f0f7ff;
    border-left: 3px solid var(--primary-color);
}

.notification-item.read {
    opacity: 0.7;
}

.notification-title {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-color);
}

.notification-message {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 5px;
}

.notification-time {
    font-size: 11px;
    color: var(--text-light);
}

.notification-loading,
.notification-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-light);
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
    padding: 10px 20px;
    width: 100%;
}

.user-name {
    color: white;
    font-weight: 500;
}

.user-name a {
    color: inherit;
    text-decoration: none;
}

.user-name a:hover {
    text-decoration: underline;
}

/* Dark Mode Toggle Button */
#darkModeToggle {
    padding: 6px 12px;
    margin-right: 8px;
    font-size: 18px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

#darkModeToggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Logo Link */
.logo-link {
    text-decoration: none;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-link:hover {
    opacity: 0.9;
}

.logo-link .logo {
    margin: 0;
}

.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    text-align: center;
}

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

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

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Main Content */
.app-main {
    flex: 1;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 20px;
    padding-bottom: 60px; /* Extra bottom padding to prevent footer overlap */
}

.container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 10px;
    margin-bottom: 80px; /* Increased bottom margin to prevent footer overlap */
    width: 100%;
    min-height: auto; /* Allow card to grow with content */
}

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

.card-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

/* Tables */
.table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 300px);
    margin-bottom: 20px;
    position: relative;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 100%;
}

/* Ensure table doesn't get compressed - minimum width for packages table with 11 columns */
.table-container table {
    min-width: 1400px;
    width: 100%;
}

/* Sticky header for scrollable tables */
.table-container table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-color);
}

.table-container table thead th {
    background: var(--bg-color);
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    border-radius: 8px;
    overflow: hidden;
    table-layout: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    border-radius: 8px;
    overflow: hidden;
}

thead {
    background: var(--bg-color);
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    display: table-cell;
    vertical-align: middle;
}

th {
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
}

/* Allow text wrapping in cells but ensure columns are visible */
td {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

tbody tr:hover {
    background: #f9f9f9;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Mobile Responsive Tables */
@media (max-width: 768px) {
    .table-container {
        max-height: none;
        border: none;
        border-radius: 0;
    }
    
    .table-container table {
        min-width: 100%;
        font-size: 13px;
    }
    
    .table-container table th,
    .table-container table td {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .table-container table th {
        font-size: 11px;
        white-space: normal;
    }
    
    /* Stack table on very small screens */
    @media (max-width: 480px) {
        .table-container {
            overflow-x: visible;
        }
        
        .table-container table,
        .table-container table thead,
        .table-container table tbody,
        .table-container table th,
        .table-container table td,
        .table-container table tr {
            display: block;
        }
        
        .table-container table thead {
            display: none;
        }
        
        .table-container table tr {
            margin-bottom: 15px;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 10px;
            background: var(--bg-white);
        }
        
        .table-container table td {
            border: none;
            padding: 8px 0;
            text-align: left !important;
            position: relative;
            padding-left: 50%;
        }
        
        .table-container table td:before {
            content: attr(data-label);
            position: absolute;
            left: 0;
            width: 45%;
            font-weight: 600;
            color: var(--text-light);
            font-size: 11px;
            text-transform: uppercase;
        }
    }
    
    /* Responsive data tables */
    .data-table {
        font-size: 13px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    @media (max-width: 480px) {
        .data-table,
        .data-table thead,
        .data-table tbody,
        .data-table th,
        .data-table td,
        .data-table tr {
            display: block;
        }
        
        .data-table thead {
            display: none;
        }
        
        .data-table tr {
            margin-bottom: 15px;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 10px;
            background: var(--bg-white);
        }
        
        .data-table td {
            border: none;
            padding: 8px 0;
            text-align: left !important;
            position: relative;
            padding-left: 50%;
        }
        
        .data-table td:before {
            content: attr(data-label);
            position: absolute;
            left: 0;
            width: 45%;
            font-weight: 600;
            color: var(--text-light);
            font-size: 11px;
            text-transform: uppercase;
        }
    }
}

/* Customer dashboard (and similar) table wrapper – fit to screen, no overflow */
.customer-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0;
}

.customer-table-wrap .data-table {
    min-width: 0;
    width: 100%;
}

/* Responsive card-style table from 768px down so generated info fits all screen sizes */
@media (max-width: 768px) {
    .data-table-responsive,
    .data-table-responsive thead,
    .data-table-responsive tbody,
    .data-table-responsive th,
    .data-table-responsive td,
    .data-table-responsive tr {
        display: block;
    }

    .data-table-responsive thead {
        display: none;
    }

    .data-table-responsive tr {
        margin-bottom: 15px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 12px;
        background: var(--bg-white);
    }

    .data-table-responsive td {
        border: none;
        padding: 8px 0;
        text-align: left !important;
        position: relative;
        padding-left: 48%;
        word-break: break-word;
    }

    .data-table-responsive td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        font-weight: 600;
        color: var(--text-light);
        font-size: 11px;
        text-transform: uppercase;
    }

    .customer-table-wrap {
        overflow-x: visible;
    }
}

/* Forms */
.card form {
    padding-bottom: 40px; /* Extra bottom padding for forms in cards to prevent footer overlap */
}

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

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-color);
}

.required-mark {
    color: var(--error-color);
    margin-left: 3px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.form-control:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.form-control.is-invalid {
    border-color: var(--error-color);
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23d63638'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6 .4.4.4-.4m0 4.8-.4-.4-.4.4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-valid {
    border-color: var(--success-color);
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2300a32a' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 5px;
    font-size: 13px;
    color: var(--error-color);
}

.valid-feedback {
    display: block;
    width: 100%;
    margin-top: 5px;
    font-size: 13px;
    color: var(--success-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

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

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

.page-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.form-help {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-light);
}

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

select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
    appearance: none;
}

/* File Upload */
.file-upload-group {
    margin-bottom: 20px;
}

.file-upload-wrapper {
    position: relative;
}

.file-upload-area {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-color);
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(34, 113, 177, 0.05);
}

.file-upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(34, 113, 177, 0.1);
}

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

.file-upload-placeholder {
    pointer-events: none;
}

.file-upload-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 10px;
}

.file-upload-text {
    display: block;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 5px;
}

.file-upload-hint {
    display: block;
    font-size: 12px;
    color: var(--text-light);
}

.file-preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.file-preview-item {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-white);
}

.file-preview-image-wrap {
    position: relative;
    min-height: 120px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
}

.file-preview-image {
    width: 100%;
    height: 150px;
    object-fit: contain;
    display: block;
}

.file-preview-item--logo .file-preview-image-wrap {
    min-height: 120px;
    max-width: 100%;
}

.file-preview-item--logo .file-preview-image {
    max-width: 100%;
    height: 120px;
    width: auto;
    object-fit: contain;
    object-position: center;
}

.file-preview-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 80px;
    padding: 12px;
    color: var(--text-light);
    font-size: 14px;
}

.file-preview-icon {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    background: var(--bg-color);
}

.file-preview-name {
    display: block;
    padding: 10px;
    font-size: 12px;
    color: var(--text-color);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.file-preview-size {
    display: block;
    padding: 0 10px 10px;
    font-size: 11px;
    color: var(--text-light);
}

.file-preview-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(214, 54, 56, 0.9);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.file-preview-remove:hover {
    background: var(--error-color);
    transform: scale(1.1);
}

/* Search and Filter */
.search-filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.filter-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-color);
    transition: var(--transition);
    min-width: 40px;
    text-align: center;
}

.pagination a:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination .active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

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

.stat-card {
    background: var(--bg-white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

.stat-label {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary-color);
}

/* Toast Notifications – centered for full visibility */
#toastContainer {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: min(400px, calc(100vw - 40px));
    pointer-events: none;
}

#toastContainer .toast {
    pointer-events: auto;
}

.toast {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 15px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid;
    min-width: 300px;
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--error-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast.info {
    border-left-color: var(--info-color);
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error .toast-icon {
    color: var(--error-color);
}

.toast.warning .toast-icon {
    color: var(--warning-color);
}

.toast.info .toast-icon {
    color: var(--info-color);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-light);
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    color: var(--text-color);
}

@keyframes slideIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.95);
        opacity: 0;
    }
}

.toast.hiding {
    animation: slideOut 0.3s ease forwards;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.loading-spinner {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
}

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

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Footer */
.app-footer {
    background: white;
    padding: 20px;
    text-align: center;
    color: var(--text-light);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-header {
        display: flex;
        flex-direction: column;
    }

    .header-content {
        order: -1;
        position: relative;
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    }

    .header-top-menu {
        order: 0;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--primary-color);
        flex-direction: column;
        padding: 20px;
        box-shadow: var(--shadow-lg);
    }

    .main-nav.active {
        display: flex;
    }

    .nav-link {
        width: 100%;
        padding: 12px;
    }

    .header-right {
        flex-direction: column;
        gap: 10px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .search-filter-bar {
        flex-direction: column;
    }

    .search-box {
        width: 100%;
    }
    
    /* Mobile responsive cards and containers */
    .card {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .card-title {
        font-size: 18px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .page-header h1 {
        font-size: 24px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .package-details-grid,
    .invoice-details-grid,
    .tracking-info-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .info-section {
        padding: 15px;
    }

    .table-container {
        overflow-x: auto;
        overflow-y: auto;
        max-height: calc(100vh - 250px);
    }

    table {
        min-width: 600px;
    }

    #toastContainer {
        max-width: calc(100vw - 40px);
    }

    .toast {
        min-width: auto;
    }

    .app-main {
        margin: 0;
        width: 100%;
        padding: 15px;
        padding-bottom: 60px; /* Extra bottom padding to prevent footer overlap */
    }

    .card {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .app-main {
        margin: 0;
        width: 100%;
        padding: 10px;
        padding-bottom: 60px; /* Extra bottom padding to prevent footer overlap */
    }

    .logo {
        font-size: 20px;
    }

    .card-title {
        font-size: 18px;
    }

    .stat-value {
        font-size: 24px;
    }

    th, td {
        padding: 8px 10px;
        font-size: 13px;
    }
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: var(--bg-white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Widgets */
.widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.widget-card {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.widget-header {
    background: var(--primary-color);
    color: white;
    padding: 15px 20px;
}

.widget-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.widget-content {
    padding: 20px;
}

.quick-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.quick-stat:last-child {
    border-bottom: none;
}

.quick-stat-label {
    color: var(--text-light);
    font-size: 14px;
}

.quick-stat-value {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 16px;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    transition: var(--transition);
    border: 2px solid transparent;
}

.quick-action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.quick-action-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.quick-action-text {
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

/* Activity Feed */
.activity-feed {
    max-height: 500px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.activity-item:hover {
    background: var(--bg-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    font-size: 24px;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border-radius: 50%;
}

.activity-content {
    flex: 1;
}

.activity-message {
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--text-color);
}

.activity-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--text-light);
}

.activity-user {
    font-weight: 500;
}

.activity-time {
    color: var(--text-light);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

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

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.d-none {
    display: none;
}

.d-flex {
    display: flex;
}

.gap-10 {
    gap: 10px;
}

.gap-20 {
    gap: 20px;
}

/* Responsive Charts and Widgets */
@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .widgets-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        height: 250px;
    }
}

/* Package Tracking Styles */
.tracking-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.info-item {
    padding: 10px 0;
}

.info-item strong {
    display: block;
    color: var(--text-light);
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.info-item div {
    color: var(--text-color);
    font-size: 14px;
}

.package-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.info-section {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
}

.info-section h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 600;
}

.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fee;
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

/* ========== Sticky table headers (all tables) ========== */
.table-container table thead th,
.data-table thead th,
table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg-white);
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.08);
}
.table-container table thead th {
    background: var(--bg-color);
}

/* ========== Dark mode ========== */
body.app-theme-dark {
    --text-color: #e0e0e0;
    --text-light: #b0b0b0;
    --bg-color: #1a1a1a;
    --bg-white: #252525;
    --border-color: #404040;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.5);
}
body.app-theme-dark .app-main,
body.app-theme-dark .card,
body.app-theme-dark .page-header {
    background: var(--bg-white);
    color: var(--text-color);
}
body.app-theme-dark .card {
    border-color: var(--border-color);
}
body.app-theme-dark .table-container table thead th,
body.app-theme-dark .data-table thead th,
body.app-theme-dark table thead th {
    background: var(--bg-color);
    color: var(--text-color);
    border-color: var(--border-color);
}
body.app-theme-dark .form-control,
body.app-theme-dark input,
body.app-theme-dark select,
body.app-theme-dark textarea {
    background: var(--bg-color);
    color: var(--text-color);
    border-color: var(--border-color);
}
body.app-theme-dark .btn-secondary,
body.app-theme-dark .btn-cancel {
    background: var(--border-color);
    color: var(--text-color);
}
body.app-theme-dark .stat-card {
    background: var(--bg-white);
    border-color: var(--border-color);
}
body.app-theme-dark .quick-action-btn {
    background: var(--bg-white);
    color: var(--text-color);
    border-color: var(--border-color);
}
body.app-theme-dark .quick-action-btn:hover {
    background: var(--border-color);
}
body.app-theme-dark .form-section .section-title,
body.app-theme-dark h1, body.app-theme-dark h2, body.app-theme-dark h3 {
    color: var(--text-color);
}
body.app-theme-dark .form-section .section-description,
body.app-theme-dark .form-help,
body.app-theme-dark small {
    color: var(--text-light);
}
body.app-theme-dark table td,
body.app-theme-dark .data-table td {
    border-color: var(--border-color);
    color: var(--text-color);
}
body.app-theme-dark .app-footer {
    background: var(--bg-color);
    color: var(--text-light);
    border-color: var(--border-color);
}
body.app-theme-dark .notifications-dropdown {
    background: var(--bg-white);
    border-color: var(--border-color);
    color: rgba(0, 0, 0, 1);
}
body.app-theme-dark .notifications-dropdown .notification-item {
    border-color: var(--border-color);
    color: var(--text-color);
}
body.app-theme-dark .badge {
    border-color: var(--border-color);
}

/* Dark mode – Settings page and Modern Form (match Dashboard theme) */
body.app-theme-dark .settings-fullpage {
    background: var(--bg-color);
}
body.app-theme-dark .settings-main {
    background: var(--bg-color);
}
body.app-theme-dark .settings-panel .card,
body.app-theme-dark .settings-panel .card.collapsible-section {
    background: var(--bg-white);
    border-color: var(--border-color);
}
body.app-theme-dark .modern-form .form-body {
    background: var(--bg-white);
}
body.app-theme-dark .modern-form .form-section {
    background: var(--bg-color);
    border-color: var(--border-color);
}
body.app-theme-dark .modern-form .section-header {
    border-bottom-color: var(--border-color);
}
body.app-theme-dark .modern-form .section-title {
    color: var(--text-color);
}
body.app-theme-dark .modern-form .section-description,
body.app-theme-dark .modern-form .form-help {
    color: var(--text-light);
}
body.app-theme-dark .modern-form .form-label {
    color: var(--text-color);
}
body.app-theme-dark .modern-form .form-control {
    background: var(--bg-color);
    color: var(--text-color);
    border-color: var(--border-color);
}
body.app-theme-dark .modern-form .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.2);
}
body.app-theme-dark .modern-form .form-actions {
    border-top-color: var(--border-color);
}
body.app-theme-dark .modern-form .btn-cancel {
    background: var(--bg-color);
    color: var(--text-light);
    border-color: var(--border-color);
}
body.app-theme-dark .modern-form .btn-cancel:hover {
    background: var(--border-color);
    border-color: var(--text-light);
}
body.app-theme-dark .modern-form .btn-secondary {
    background: var(--border-color);
    color: var(--text-color);
}
body.app-theme-dark .modern-form .btn-secondary:hover {
    background: var(--text-light);
    color: var(--bg-white);
}
body.app-theme-dark .modern-form .card {
    background: var(--bg-white);
    border-color: var(--border-color);
}
body.app-theme-dark .modern-form .image-preview {
    border-color: var(--border-color);
}
body.app-theme-dark .modern-form .info-badge {
    background: rgba(34, 113, 177, 0.15);
    border-color: var(--primary-color);
    color: var(--primary-light);
}
body.app-theme-dark .modern-form .info-badge svg {
    fill: var(--primary-light);
}
body.app-theme-dark .modern-form .form-error-message {
    background: rgba(214, 54, 56, 0.15);
    border-color: var(--error-color);
    color: #f8a0a5;
}
body.app-theme-dark .modern-form .invalid-feedback {
    color: #f8a0a5;
}
body.app-theme-dark .modern-form select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e0e0e0' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}
body.app-theme-dark .file-upload-area {
    background: var(--bg-color);
    border-color: var(--border-color);
}
body.app-theme-dark .file-upload-area:hover,
body.app-theme-dark .file-upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(34, 113, 177, 0.08);
}
body.app-theme-dark .file-upload-text {
    color: var(--text-color);
}
body.app-theme-dark .file-upload-hint {
    color: var(--text-light);
}
body.app-theme-dark .file-preview-item {
    background: var(--bg-white);
    border-color: var(--border-color);
}
body.app-theme-dark .file-preview-name {
    color: var(--text-color);
}
body.app-theme-dark .file-preview-size {
    color: var(--text-light);
}
body.app-theme-dark .settings-panel .table-container,
body.app-theme-dark .settings-panel table {
    border-color: var(--border-color);
}
body.app-theme-dark .settings-panel table th,
body.app-theme-dark .settings-panel table td {
    border-color: var(--border-color);
    color: var(--text-color);
}
body.app-theme-dark .settings-panel table thead th {
    background: var(--bg-color);
    color: var(--text-color);
}
body.app-theme-dark .settings-panel tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Dark mode – override inline styles in Settings content (grey boxes, muted text, borders) */
body.app-theme-dark .settings-fullpage .form-body div[style*="background: #f8f9fa"],
body.app-theme-dark .settings-fullpage .form-body div[style*="background:#f8f9fa"],
body.app-theme-dark .settings-fullpage div[style*="background: #f8f9fa"],
body.app-theme-dark .settings-fullpage div[style*="background:#f8f9fa"] {
    background: var(--bg-color) !important;
    border-color: var(--border-color) !important;
}
body.app-theme-dark .settings-fullpage div[style*="color: #6c757d"],
body.app-theme-dark .settings-fullpage div[style*="color:#6c757d"],
body.app-theme-dark .settings-fullpage p[style*="color: #6c757d"],
body.app-theme-dark .settings-fullpage p[style*="color:#6c757d"],
body.app-theme-dark .settings-fullpage ul[style*="color: #6c757d"],
body.app-theme-dark .settings-fullpage ul[style*="color:#6c757d"] {
    color: var(--text-light) !important;
}
body.app-theme-dark .settings-fullpage p[style*="color: #495057"],
body.app-theme-dark .settings-fullpage p[style*="color:#495057"] {
    color: var(--text-color) !important;
}
body.app-theme-dark .settings-fullpage div[style*="border-top: 1px solid #e9ecef"],
body.app-theme-dark .settings-fullpage div[style*="border-top:1px solid #e9ecef"],
body.app-theme-dark .settings-fullpage .form-body[style*="border-top"] {
    border-top-color: var(--border-color) !important;
}
body.app-theme-dark .settings-fullpage div[style*="border: 2px dashed #dee2e6"],
body.app-theme-dark .settings-fullpage div[style*="border:2px dashed #dee2e6"] {
    border-color: var(--border-color) !important;
}
body.app-theme-dark .settings-fullpage .form-body .btn[style*="background: #f8f9fa"],
body.app-theme-dark .settings-fullpage .form-body .btn[style*="background:#f8f9fa"] {
    background: var(--border-color) !important;
    color: var(--primary-light) !important;
    border-color: var(--primary-color) !important;
}
body.app-theme-dark .settings-fullpage .form-body .btn[style*="background: #f8f9fa"]:hover,
body.app-theme-dark .settings-fullpage .form-body .btn[style*="background:#f8f9fa"]:hover {
    background: var(--primary-color) !important;
    color: #fff !important;
}
body.app-theme-dark .settings-fullpage a[style*="color: #667eea"],
body.app-theme-dark .settings-fullpage a[style*="color:#667eea"] {
    color: var(--primary-light) !important;
}
body.app-theme-dark .settings-fullpage span[style*="color: #999"] {
    color: var(--text-light) !important;
}

/* ==========================================================================
   Modern Form & Settings – tab content and container sections (single source)
   ========================================================================== */

/* Modern Form – shared across all forms and settings panels */
.modern-form {
    width: 100%;
    max-width: 1200px;
    height: fit-content;
    margin: 0 auto;
}

.modern-form .form-header {
    background: var(--primary-color);
    border-radius: 12px 12px 0 0;
    padding: 10px;
    color: white;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 0;
}

.modern-form .form-header-content {
    flex: 1;
}

.modern-form .form-header h2 {
    margin: 0 0 5px 0;
    font-size: 24px;
    font-weight: 600;
}

.modern-form .form-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 14px;
}

.modern-form .form-icon-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.modern-form .avatar-with-initials {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 4px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.modern-form .avatar-with-initials img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.modern-form .avatar-initials-text {
    position: relative;
    z-index: 1;
}

.modern-form .form-body {
    padding: 40px;
    background: #fff;
}

.modern-form .form-section {
    margin-bottom: 40px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.modern-form .form-section:last-child {
    margin-bottom: 0;
}

.modern-form .section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.modern-form .section-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    flex-shrink: 0;
}

.modern-form .section-title {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.modern-form .section-description {
    font-size: 14px;
    color: #6c757d;
    margin-top: 5px;
}

.modern-form .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.modern-form .form-grid.full-width {
    grid-template-columns: 1fr;
}

.modern-form .form-group {
    margin-bottom: 0;
}

.modern-form .form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    color: #495057;
    font-weight: 500;
    font-size: 14px;
}

.modern-form .required-mark {
    color: #dc3545;
    font-weight: 600;
}

.modern-form .form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #fff;
    color: #495057;
}

.modern-form .form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.modern-form .form-control.is-invalid {
    border-color: #dc3545;
}

.modern-form .form-control.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

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

.modern-form select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
    appearance: none;
}

.modern-form .invalid-feedback {
    display: block;
    margin-top: 6px;
    color: #dc3545;
    font-size: 13px;
    font-weight: 500;
}

.modern-form .form-help {
    display: block;
    margin-top: 6px;
    color: #6c757d;
    font-size: 13px;
}

.modern-form .form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 30px;
    margin-top: 30px;
    border-top: 2px solid #e9ecef;
}

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

.modern-form .btn-primary {
    background: #667eea;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.modern-form .btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.modern-form .btn-secondary {
    background: #6c757d;
    color: white;
}

.modern-form .btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.modern-form .btn-cancel {
    background: #fff;
    color: #6c757d;
    border: 2px solid #dee2e6;
}

.modern-form .btn-cancel:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.modern-form .info-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    font-size: 13px;
    color: #0066cc;
    margin-top: 10px;
}

.modern-form .info-badge svg {
    width: 16px;
    height: 16px;
    fill: #0066cc;
}

.modern-form .profile-image-section {
    text-align: center;
}

.modern-form .image-preview-container {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
}

.modern-form .image-preview {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #e9ecef;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.modern-form .image-preview:hover {
    border-color: #667eea;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.modern-form .image-upload-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 45px;
    height: 45px;
    background: #667eea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.modern-form .image-upload-overlay:hover {
    background: #5568d3;
    transform: scale(1.1);
}

.modern-form .image-upload-overlay svg {
    width: 20px;
    height: 20px;
    stroke: white;
    fill: none;
}

.modern-form .form-error-message {
    color: #dc3545;
    font-size: 14px;
    padding: 8px 12px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

.modern-form .card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    background: #fff;
}

@media (max-width: 768px) {
    .modern-form .form-body {
        padding: 20px;
    }
    .modern-form .form-header {
        flex-direction: column;
        text-align: center;
    }
    .modern-form .form-grid {
        grid-template-columns: 1fr;
    }
    .modern-form .form-section {
        padding: 20px;
    }
    .modern-form .form-actions {
        flex-direction: column-reverse;
    }
    .modern-form .btn {
        width: 100%;
        justify-content: center;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modern-form .form-section {
    animation: slideIn 0.3s ease-out;
}

/* Settings – full-page layout: sidebar + main, tab panels (same padding/margins as app-main) */
.settings-fullpage {
    display: flex;
    min-height: calc(100vh - 140px);
    margin: 0;
    width: 100%;
    max-width: 100%;
    background: #f5f6fa;
    box-sizing: border-box;
    border-radius: 8px;
    overflow: hidden;
}

.settings-sidebar {
    width: 260px;
    min-width: 260px;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.settings-sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-weight: 600;
    font-size: 18px;
}

.settings-sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.settings-tab-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    border-left: 3px solid transparent;
}

.settings-tab-link:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.settings-tab-link.active {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border-left-color: var(--primary-light);
}

.settings-tab-link .tab-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.settings-main {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.settings-panel {
    display: none !important;
    animation: settingsPanelFade 0.2s ease;
}

.settings-panel.active {
    display: flex !important;
    flex: 1;
    flex-direction: column;
    min-height: 100%;
}

.settings-panel .modern-form {
    width: 100%;
    height: fit-content;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.settings-panel .card,
.settings-panel .card.collapsible-section {
    flex: 1;
    margin-bottom: 24px;
    width: 100%;
    padding: 5px;
    box-sizing: border-box;
}

@keyframes settingsPanelFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.settings-panel .collapsible-section .form-body {
    max-height: none;
}

.settings-fullpage .form-icon-large {
    width: 30px;
    height: 30px;
    font-size: 43px;
}

#theme_color {
    height: 50px;
}

.settings-fullpage .collapsible-section .form-header::after {
    display: none;
}

.settings-fullpage .collapsible-section .form-header {
    cursor: default;
    user-select: none;
}

.settings-fullpage .collapsible-section .form-body {
    max-height: none;
    opacity: 1;
}

.settings-fullpage .collapsible-section.collapsed .form-body {
    max-height: none;
    opacity: 1;
    padding: inherit;
    margin: inherit;
}

@media (max-width: 900px) {
    .settings-fullpage {
        flex-direction: column;
        min-height: auto;
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        min-width: 0;
    }
    .settings-sidebar {
        width: 100%;
        min-width: 0;
        flex-direction: row;
        overflow-x: auto;
        padding: 12px;
        gap: 8px;
    }
    .settings-sidebar-brand {
        display: none;
    }
    .settings-sidebar-nav {
        display: flex;
        flex-wrap: nowrap;
        padding: 0;
    }
    .settings-tab-link {
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 10px 14px;
    }
    .settings-tab-link.active {
        border-left: none;
        border-bottom-color: var(--primary-light);
    }
}
