/* Import Typography Fonts */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Work+Sans:wght@300;400;500;600&display=swap');

:root {
    /* Typography Fonts */
    --font-heading: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;  /* Rigid Square alternative */
    --font-body: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;  /* DIN alternative */

    /* Primary Colors - Teals and greys for main UI elements */
    --primary-dark: #018287;      /* Dark teal - main brand color */
    --primary-light: #5BC2C6;     /* Light teal - accents */
    --primary-hover: #016166;     /* Darker teal for hovers */
    --grey-dark: #4A5555;         /* Dark grey - primary text (enhanced contrast) */
    --grey-medium: #6B7676;       /* Medium grey - secondary text (enhanced contrast) */
    --grey-light: #8A9090;        /* Light grey - tertiary text */

    /* Secondary Colors - Greens for supporting elements */
    --secondary-dark: #27544D;    /* Dark green */
    --secondary-medium: #558E7B;  /* Medium green */
    --secondary-light: #85BAA6;   /* Light green */
    --secondary-pale: #D2E9DB;    /* Pale green - backgrounds */

    /* Typography - using grey shades for elegance */
    --text-primary: #4A5555;      /* Body text - enhanced contrast */
    --text-secondary: #6B7676;    /* Labels, hints - enhanced contrast */
    --text-dark: #27544D;         /* Emphasis text */
    --heading-color: #018287;     /* All headings use primary dark teal */

    /* Legacy aliases for backward compatibility */
    --primary-color: #018287;

    /* System colors */
    --success-color: #558E7B;
    --error-color: #EF4444;
    --bg-color: #FAFBFB;
    --panel-bg: #FFFFFF;
    --border-color: #D2E9DB;

    /* Refined shadows for depth */
    --shadow: 0 1px 3px 0 rgba(1, 130, 135, 0.08), 0 1px 2px 0 rgba(1, 130, 135, 0.04);
    --shadow-lg: 0 10px 25px -5px rgba(1, 130, 135, 0.15), 0 4px 6px -2px rgba(1, 130, 135, 0.08);
    --shadow-btn: 0 2px 8px rgba(1, 130, 135, 0.20);
    --shadow-btn-hover: 0 4px 16px rgba(1, 130, 135, 0.30);
}

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

body {
    font-family: var(--font-body);  /* DIN font for body text */
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    letter-spacing: 0.01em;
}

/* Typography - All headings use Rigid Square font and primary teal color */
h1, h2, h3, h4 {
    font-family: var(--font-heading);  /* Rigid Square font for headings */
    color: var(--heading-color);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.2rem;
}

h4 {
    font-size: 1rem;
}

/* Paragraphs and text elements use grey shades and body font */
p, span, label, li, button, input, textarea, select {
    color: var(--text-primary);
    font-family: var(--font-body);
}

/* Small text and hints */
small, .hint, .label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-family: var(--font-body);
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    text-align: center;
}

.header-logo {
    height: 140px;
    width: auto;
    object-fit: contain;
    /* Remove white background by making white transparent, then invert to white logo */
    mix-blend-mode: screen;
    filter: invert(1);
}

.header-text {
    text-align: center;
    margin: 0 auto;
    max-width: 520px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 8px;
    font-weight: 600;
    color: white;
    letter-spacing: -0.02em;
}

/* Responsive header layout */
@media (max-width: 768px) {
    .header-logo {
        height: 100px;
    }
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 400;
    color: white;
}

.main-content {
    display: flex;
    justify-content: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    animation: fadeIn 0.4s ease-in;
}

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

.panel {
    background: var(--panel-bg);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(1, 130, 135, 0.08);
    border: 1px solid var(--border-color);
    width: 100%;
    transition: box-shadow 0.3s ease;
}

.panel:hover {
    box-shadow: 0 6px 20px rgba(1, 130, 135, 0.12);
}

.panel h2 {
    margin-bottom: 1.75rem;
    color: var(--heading-color);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--secondary-pale);
}

/* Upload Panel */
.upload-panel {
    max-width: 700px;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 2rem;
    background: #FAFBFB;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: var(--secondary-pale);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background-color: #E8F5F1;
    border-width: 3px;
    transform: scale(1.02);
}

.upload-area svg {
    color: var(--primary-light);
    margin-bottom: 1.25rem;
}

.upload-text {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
    font-weight: 500;
}

.upload-subtext {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.75rem;
    margin-bottom: 1.5rem;
}

.upload-status {
    margin-top: 1.5rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
}

.status-item {
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    border-radius: 8px;
    border-left: 4px solid;
    font-size: 0.95rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: transform 0.2s;
}

.status-item:hover {
    transform: translateX(4px);
}

.status-item.success {
    background-color: var(--secondary-pale);
    border-color: var(--success-color);
    color: var(--secondary-dark);
}

.status-item.error {
    background-color: #FEE2E2;
    border-color: var(--error-color);
    color: #991B1B;
}

.status-item.loading {
    background-color: #E0F2F3;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Stats Section */
.stats-section {
    margin-top: 2.5rem;
    padding: 1.5rem;
    border-top: 2px solid var(--border-color);
    background: linear-gradient(135deg, #FAFBFB 0%, white 100%);
    border-radius: 12px;
}

.stats-section h3 {
    margin-bottom: 1.25rem;
    color: var(--text-dark);
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(1, 130, 135, 0.1);
    border-color: var(--primary-light);
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
}

.stat-value {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.05rem;
}

/* Buttons - Refined, prestigious styling */
.btn {
    padding: 0.75rem 1.75rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    letter-spacing: 0.01em;
    font-family: var(--font-body);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Primary Button - "Get In Touch" style */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
    color: white;
    font-weight: 600;
    box-shadow: var(--shadow-btn);
    border: 1px solid transparent;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary-dark) 100%);
    transform: translateY(-3px);
    box-shadow: var(--shadow-btn-hover);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(-1px);
}

/* Secondary Button - "See It In Action" style */
.btn-secondary {
    background: white;
    color: var(--primary-dark);
    border: 2px solid var(--border-color);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--secondary-pale);
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(1, 130, 135, 0.15);
}

.btn-secondary:active:not(:disabled) {
    transform: translateY(0);
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(1, 130, 135, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-light);
}

/* Navigation */
.admin-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.admin-nav a {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: white;
    border-radius: 6px;
    transition: background-color 0.2s;
    font-weight: 500;
}

.admin-nav a:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.admin-nav a.active {
    background-color: rgba(255, 255, 255, 0.25);
}

.btn-sm {
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    border-radius: 8px;
    font-weight: 600;
}

/* Tab Management */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Upload Controls */
.upload-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--secondary-pale) 0%, #F0F9F6 100%);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(1, 130, 135, 0.05);
}

.upload-controls label {
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    font-size: 0.95rem;
}

.folder-select {
    flex: 1;
    padding: 0.65rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: white;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.folder-select:hover {
    border-color: var(--primary-light);
}

.folder-select:focus {
    outline: none;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(1, 130, 135, 0.1);
}

/* Document Browser */
.document-browser {
    margin-top: 1.5rem;
}

.browser-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #F8FBFB 0%, white 100%);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.breadcrumb {
    font-size: 0.95rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb span {
    color: var(--primary-dark);
    font-weight: 600;
    transition: all 0.2s;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.breadcrumb span:hover {
    background: var(--secondary-pale);
    color: var(--primary-hover);
}

.breadcrumb .current {
    color: var(--text-primary);
    font-weight: 600;
    background: var(--secondary-pale);
}

/* Document List */
.document-list {
    min-height: 450px;
    background: white;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.document-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.document-table thead {
    background: linear-gradient(135deg, var(--secondary-pale) 0%, #F0F9F6 100%);
    position: sticky;
    top: 0;
    z-index: 10;
}

.document-table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.checkbox-header {
    width: 40px;
    text-align: center;
}

.checkbox-header input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-dark);
}

.document-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #E8F1EE;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.document-table tbody tr {
    transition: all 0.2s ease;
}

.document-table tbody tr:hover {
    background: #F8FCFB;
    transform: scale(1.005);
    box-shadow: 0 2px 8px rgba(1, 130, 135, 0.08);
}

.folder-row {
    cursor: pointer;
    font-weight: 500;
}

.folder-row:hover {
    background: #E8F5F1 !important;
}

.folder-row td:first-child {
    color: var(--primary-dark);
}

.file-row {
    transition: all 0.2s ease;
}

.file-row.selected {
    background: #E8F5F1 !important;
    border-left: 3px solid var(--primary-dark);
}

.document-checkbox {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-dark);
    margin: 0;
}

.document-checkbox:hover {
    transform: scale(1.1);
}

/* Bulk Actions Bar */
.bulk-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(1, 130, 135, 0.2);
    animation: slideDown 0.3s ease;
}

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

.bulk-actions-info {
    color: white;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bulk-actions-info span {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 700;
}

.bulk-actions .btn {
    background: white;
    color: var(--primary-dark);
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.bulk-actions .btn:hover {
    background: #F0F9F6;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.bulk-actions .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Small spinner for loading state */
.spinner-small {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(1, 130, 135, 0.2);
    border-top-color: var(--primary-dark);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 0.5rem;
}

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

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.06);
    transform: scale(1.1);
}

.btn-delete {
    color: var(--error-color);
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.loading-message,
.empty-message,
.error-message {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    font-size: 1.05rem;
}

.empty-message {
    background: linear-gradient(135deg, #F8FCFB 0%, white 100%);
    border-radius: 8px;
    margin: 2rem;
}

.error-message {
    color: var(--error-color);
    background: #FEF2F2;
    border-radius: 8px;
    margin: 2rem;
    border: 1px solid #FEE2E2;
}

/* ===== USER MANAGEMENT STYLES ===== */

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.panel-header h2 {
    margin: 0;
}

.users-section {
    margin-top: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.users-table-container {
    overflow-x: auto;
    margin-top: 1rem;
}

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

.users-table th,
.users-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.users-table th {
    background-color: #F8FCFB;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-heading);
}

.users-table tr:hover {
    background-color: #F8FCFB;
}

.users-table tr:last-child td {
    border-bottom: none;
}

/* Status badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
}

.status-pending {
    background-color: #FFF3CD;
    color: #856404;
}

.status-active {
    background-color: #D4EDDA;
    color: #155724;
}

/* Role badges */
.role-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
}

.role-admin {
    background-color: #E3F2FD;
    color: #1565C0;
}

.role-customer {
    background-color: #F3E5F5;
    color: #6A1B9A;
}

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

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

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

.modal-header h3 {
    margin: 0;
}

.close {
    font-size: 2rem;
    font-weight: 300;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

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

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Form tabs */
.form-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary-dark);
    border-bottom-color: var(--primary-dark);
    font-weight: 600;
}

.register-form-section {
    padding: 0 1.5rem;
}

.email-form-section {
    padding: 0;
}

/* Form groups */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-family: var(--font-body);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: var(--font-body);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(1, 130, 135, 0.1);
}

.form-group textarea {
    resize: vertical;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.help-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0.5rem 0 0 0;
    font-style: italic;
}

.email-status {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
    background-color: var(--panel-bg);
}