/* =========================================
   ProHat Demo Portal — Global Styles
   ========================================= */

:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-primary-light: #dbeafe;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --color-success: #16a34a;
    --color-success-bg: #f0fdf4;
    --color-error: #dc2626;
    --color-error-bg: #fef2f2;
    --color-info: #0284c7;
    --color-info-bg: #f0f9ff;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: 0.2s ease;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ---- Navbar ---- */
.navbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
}
.navbar-menu {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 1.25rem;
}
.navbar-menu a { color: var(--color-text); font-weight: 500; text-decoration: none; }
.navbar-menu a:hover { color: var(--color-primary); }
.navbar-user-name { color: var(--color-text-muted); font-size: 0.875rem; }
.navbar-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.navbar-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text);
    transition: var(--transition);
}

/* ---- Main Content ---- */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: calc(100vh - 60px - 60px);
}

/* ---- Alerts ---- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-success { background: var(--color-success-bg); color: var(--color-success); border: 1px solid #bbf7d0; }
.alert-error { background: var(--color-error-bg); color: var(--color-error); border: 1px solid #fecaca; }
.alert-info { background: var(--color-info-bg); color: var(--color-info); border: 1px solid #bae6fd; }

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    text-align: center;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); color: #fff; }
.btn-outline { background: transparent; color: var(--color-text); border-color: var(--color-border); }
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-danger { background: var(--color-error); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
.btn-block { display: block; width: 100%; }

/* ---- Login Page ---- */
.login-page {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-container { width: 100%; max-width: 420px; padding: 1rem; }
.login-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-lg);
}
.login-header { text-align: center; margin-bottom: 1.5rem; }
.login-header h1 { color: var(--color-primary); margin-bottom: 0.25rem; }
.login-header p { color: var(--color-text-muted); font-size: 0.9rem; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* ---- Dashboard Grid ---- */
.page-header {
    margin-bottom: 2rem;
}
.page-header h1 { font-size: 1.75rem; font-weight: 700; }
.page-header p { color: var(--color-text-muted); }

.presentation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}
.presentation-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
    text-decoration: none;
    color: inherit;
    display: block;
}
.presentation-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
}
.card-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--color-bg);
}
.card-body { padding: 1.25rem; }
.card-body h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.35rem; }
.card-body p { font-size: 0.875rem; color: var(--color-text-muted); }

/* ---- Admin ---- */
.admin-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 1.5rem;
}
.admin-tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    text-decoration: none;
}
.admin-tab:hover { color: var(--color-text); text-decoration: none; }
.admin-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.admin-header h2 { font-size: 1.25rem; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9rem;
}
.data-table th {
    background: var(--color-bg);
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }

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

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-superuser { background: #ede9fe; color: #7c3aed; }
.badge-user { background: #f0f9ff; color: #0284c7; }
.badge-active { background: #f0fdf4; color: #16a34a; }
.badge-inactive { background: #fef2f2; color: #dc2626; }

/* ---- Form Card (admin forms) ---- */
.form-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    max-width: 600px;
}
.form-card h2 { margin-bottom: 1.5rem; }
.form-actions { margin-top: 1.5rem; display: flex; gap: 0.75rem; }

/* ---- Footer ---- */
.site-footer {
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* ---- Card Menu (superuser kebab) ---- */
.presentation-card-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}
.presentation-card-wrapper .presentation-card {
    flex: 1;
}
.presentation-card-actions {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.mobile-mode-form {
    margin: 0;
}
.mobile-mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.8rem;
    white-space: nowrap;
    user-select: none;
    cursor: pointer;
}
.mobile-mode-toggle input[type="checkbox"] {
    accent-color: var(--color-primary);
    cursor: pointer;
}
.card-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}
.card-action-link:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    text-decoration: none;
}
.card-menu-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    width: 32px;
    height: 32px;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: var(--shadow);
}

/* ---- Language Flags on Cards ---- */
.card-lang-flags {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding: 0 0.25rem;
}
.lang-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    letter-spacing: 0.03em;
}
.lang-flag:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-light);
    text-decoration: none;
}

/* ---- Settings Modal ---- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-backdrop[hidden] { display: none; }
.modal-dialog {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}
.modal-dialog h3 { margin-bottom: 1.25rem; }
.modal-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    cursor: pointer;
    margin-bottom: 1.5rem;
}
.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.viewer-shell {
    width: 100%;
    height: calc(100vh - 230px);
    min-height: 700px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-surface);
    box-shadow: var(--shadow);
}
.viewer-shell iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .navbar-toggle { display: flex; }
    .navbar-menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        padding: 1rem;
        gap: 0.75rem;
        box-shadow: var(--shadow);
    }
    .navbar-menu.open { display: flex; }
    .presentation-grid { grid-template-columns: 1fr; }
    .data-table { font-size: 0.8rem; }
    .data-table th, .data-table td { padding: 0.5rem 0.5rem; }
    .admin-header { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
}
