/* ============================================
   Corrigenda Forms - Modern Enterprise Styles
   ============================================ */

:root {
    --primary: #2A5C82;
    --primary-dark: #1e4562;
    --primary-light: #3a7cb5;
    --accent: #4A90E2;
    --accent-light: #6ba5eb;
    --bg: #f4f6f9;
    --bg-white: #ffffff;
    --text: #2d3748;
    --text-light: #718096;
    --text-muted: #a0aec0;
    --border: #e2e8f0;
    --border-light: #edf2f7;
    --success: #48bb78;
    --danger: #e53e3e;
    --warning: #ed8936;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.05);
    --transition: 0.2s ease;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent);
    text-decoration: none;
}

/* ============ HEADER ============ */
.header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-logo {
    flex-shrink: 0;
}

.logo {
    height: 40px;
    width: auto;
}

.header-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.user-greeting {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 500;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    flex: 1;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem;
}

/* ============ TABS ============ */
.tabs-container {
    width: 100%;
}

.tabs-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding-bottom: 0.25rem;
    justify-content: center;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.tabs-nav::-webkit-scrollbar {
    height: 4px;
}

.tabs-nav::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.tab-link {
    padding: 0.6rem 1.25rem;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 100px;
    cursor: pointer;
    transition: all var(--transition);
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    color: var(--text-light);
    font-family: inherit;
}

.tab-link:hover {
    background: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
    transform: translateY(-1px);
}

.tab-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(42, 92, 130, 0.3);
}

.tab-content {
    display: none;
    animation: fadeUp 0.3s ease;
}

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

/* ============ TILE CARDS GRID ============ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.tile-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow);
    transition: all 0.25s ease;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.tile-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.25s ease;
}

.tile-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-light);
}

.tile-card:hover::before {
    opacity: 1;
}

.tile-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tile-badge-internal {
    background: #ebf5ff;
    color: var(--accent);
}

.tile-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tile-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tile-icon-placeholder {
    width: 56px;
    height: 56px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.tile-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.4rem;
    line-height: 1.3;
}

.tile-description {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state h2 {
    margin: 1rem 0 0.5rem;
    color: var(--text-light);
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-xs);
    font-weight: 500;
    font-size: 0.875rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    font-family: inherit;
    line-height: 1.4;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

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

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

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(42, 92, 130, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--border);
}

.btn-outline:hover {
    background: var(--bg);
    border-color: var(--primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-light);
}

.btn-ghost:hover {
    background: var(--bg);
    color: var(--text);
}

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

.btn-danger:hover {
    background: #fff5f5;
    border-color: var(--danger);
}

.btn-azure {
    background: #0078d4;
    color: white;
    gap: 0.75rem;
}

.btn-azure:hover {
    background: #106ebe;
}

/* ============ LOGIN ============ */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    padding: 2rem;
}

.login-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    height: 48px;
    margin-bottom: 1rem;
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.login-header p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ============ FORMS ============ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--bg-white);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}

.form-group input[type="file"] {
    font-size: 0.85rem;
    color: var(--text-light);
}

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

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.current-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.preview-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px;
}

/* ============ ALERTS ============ */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-xs);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

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

.alert-success {
    background: #f0fff4;
    color: #2f855a;
    border: 1px solid #c6f6d5;
}

/* ============ BADGES ============ */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-public {
    background: #ebf8ff;
    color: #2b6cb0;
}

.badge-internal {
    background: #fefcbf;
    color: #975a16;
}

.badge-both {
    background: #f0fff4;
    color: #276749;
}

.badge-active {
    background: #f0fff4;
    color: #2f855a;
}

.badge-inactive {
    background: #fff5f5;
    color: #c53030;
}

.badge-admin {
    background: #faf5ff;
    color: #6b46c1;
}

.badge-user {
    background: var(--bg);
    color: var(--text-light);
}

/* ============ ADMIN LAYOUT ============ */
.admin-layout {
    display: flex;
    gap: 0;
    min-height: calc(100vh - 140px);
    margin: -2rem;
}

.admin-sidebar {
    width: 240px;
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0 0.75rem;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-xs);
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
}

.admin-nav-link:hover {
    background: var(--bg);
    color: var(--text);
}

.admin-nav-link.active {
    background: #ebf5ff;
    color: var(--primary);
}

.admin-sidebar-footer {
    padding: 0 0.75rem;
    border-top: 1px solid var(--border-light);
    padding-top: 0.75rem;
    margin-top: 1rem;
}

.admin-main {
    flex: 1;
    padding: 2rem;
    overflow-x: auto;
}

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

.admin-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.admin-card {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.admin-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* ============ STATS ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}

.stat-card-sm {
    padding: 1rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.4rem;
}

.stat-card-sm .stat-number {
    font-size: 1.5rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

/* ============ TABLES ============ */
.admin-table-wrapper {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.admin-table thead th {
    background: var(--bg);
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}

.admin-table tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

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

.admin-table tbody tr:hover {
    background: #fafbfd;
}

.table-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 4px;
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.inline-form {
    display: inline;
}

.inline-input {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--bg-white);
    width: 100%;
}

.inline-input:focus {
    outline: none;
    border-color: var(--accent);
}

.inline-select {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.8rem;
    font-family: inherit;
    background: var(--bg-white);
    cursor: pointer;
}

.inline-add-form .form-row {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.inline-add-form .form-group {
    flex: 1;
}

/* ============ RADIO GROUP ============ */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.radio-label:hover {
    border-color: var(--accent);
}

.radio-label.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.radio-label input[type="radio"] {
    margin-top: 0.25rem;
}

.radio-content strong {
    display: block;
    margin-bottom: 0.25rem;
}

.radio-content p {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ============ CONFIG TABLE ============ */
.config-table {
    width: 100%;
    margin-top: 1rem;
}

.config-table td {
    padding: 0.5rem 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-light);
}

.config-table td:first-child {
    width: 140px;
    color: var(--text-light);
}

.config-table code {
    background: var(--bg);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

/* ============ ERROR PAGE ============ */
.error-page {
    text-align: center;
    padding: 4rem 2rem;
}

.error-page h1 {
    font-size: 2rem;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.error-page p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

/* ============ FOOTER ============ */
.footer {
    background: var(--primary);
    color: rgba(255,255,255,0.85);
    text-align: center;
    padding: 1.25rem 2rem;
    font-size: 0.85rem;
    margin-top: auto;
}

/* ============ UTILITIES ============ */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* ============ ANIMATIONS ============ */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        padding: 0.75rem 1rem;
    }

    .header-title {
        position: static;
        transform: none;
        font-size: 1.1rem;
    }

    .main-content {
        padding: 1rem;
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 1rem 0;
    }

    .admin-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 0 0.75rem;
        gap: 0.25rem;
    }

    .admin-nav-link {
        white-space: nowrap;
    }

    .admin-sidebar-footer {
        display: none;
    }

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

    .tabs-nav {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .header-actions {
        width: 100%;
        justify-content: center;
    }

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