/* Google Forms inspired styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    background-color: #f0ebf8;
    color: #202124;
    font-size: 14px;
    line-height: 1.5;
}

/* Navbar */
.navbar {
    background: white;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.nav-logo {
    height: 36px;
    width: auto;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-right a {
    color: #5f6368;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

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

.nav-user {
    color: #5f6368;
    font-size: 13px;
}

.inline-form {
    display: inline;
}

.btn-link {
    background: none;
    border: none;
    color: #673ab7;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    padding: 0;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Flash messages */
.flash {
    max-width: 640px;
    margin: 16px auto;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 14px;
}

.flash-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.flash-error {
    background: #fce4ec;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

/* Form page */
.form-page {
    padding: 32px 16px;
    display: flex;
    justify-content: center;
}

/* Form card - Google Forms style */
.form-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 640px;
    overflow: hidden;
}

.card-header-bar {
    height: 10px;
    background: #673ab7;
    border-radius: 8px 8px 0 0;
}

.card-body {
    padding: 24px 32px;
}

.form-title {
    font-size: 32px;
    font-weight: 400;
    color: #202124;
    margin-bottom: 4px;
}

.form-subtitle {
    font-size: 14px;
    color: #5f6368;
    margin-bottom: 24px;
}

/* Section cards within the form */
.form-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 640px;
    padding: 24px 32px;
    margin-top: 16px;
}

.section-title {
    font-size: 16px;
    font-weight: 500;
    color: #202124;
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

/* Form inputs */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: #202124;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group .required::after {
    content: " *";
    color: #d93025;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Roboto', Arial, sans-serif;
    color: #202124;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #673ab7;
    box-shadow: 0 0 0 2px rgba(103, 58, 183, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Radio groups */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    accent-color: #673ab7;
    width: 18px;
    height: 18px;
}

.radio-option label {
    font-weight: 400;
    margin-bottom: 0;
    cursor: pointer;
}

/* Conditional sections */
.conditional-section {
    display: none;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.conditional-section.active {
    display: block;
}

/* Row layout */
.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

/* Buttons */
.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Roboto', Arial, sans-serif;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.btn-primary {
    background: #673ab7;
    color: white;
}

.btn-primary:hover {
    background: #5e35a1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.btn-secondary {
    background: white;
    color: #673ab7;
    border: 1px solid #dadce0;
}

.btn-secondary:hover {
    background: #f8f4fc;
}

.btn-danger {
    background: #d93025;
    color: white;
}

.btn-danger:hover {
    background: #c5221f;
}

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

.form-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
}

/* Login card specific */
.login-card {
    max-width: 440px;
}

.login-logo {
    text-align: center;
    margin-bottom: 20px;
}

.login-logo img {
    max-width: 280px;
    height: auto;
}

/* Error message */
.error-message {
    background: #fce4ec;
    color: #c62828;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 13px;
}

/* Success page */
.success-card {
    text-align: center;
    padding: 48px 32px;
}

.success-card h2 {
    color: #2e7d32;
    margin-bottom: 8px;
    font-weight: 400;
}

.success-card p {
    color: #5f6368;
}

/* Admin layout */
.admin-container {
    max-width: 1280px;
    margin: 24px auto;
    padding: 0 24px;
}

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

.admin-header h1 {
    font-size: 24px;
    font-weight: 400;
    color: #202124;
}

/* Table card — wraps toolbar, table, and footer */
.table-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.06);
    overflow: hidden;
}

/* Toolbar */
.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e8e8e8;
    gap: 16px;
    flex-wrap: wrap;
}

.toolbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.search-input-wrap {
    position: relative;
    flex: 1;
    max-width: 360px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9aa0a6;
    pointer-events: none;
}

.search-input-wrap input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    border: 1px solid #dadce0;
    border-radius: 6px;
    font-size: 13px;
    font-family: 'Roboto', Arial, sans-serif;
    color: #202124;
    background: #f8f9fa;
    transition: all 0.2s;
}

.search-input-wrap input:focus {
    outline: none;
    border-color: #673ab7;
    box-shadow: 0 0 0 2px rgba(103, 58, 183, 0.15);
    background: white;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.toolbar-info {
    flex-shrink: 0;
}

.total-badge {
    display: inline-block;
    padding: 5px 12px;
    background: #f3f0fa;
    color: #673ab7;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}

/* Filter toggle button */
.filter-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.filter-toggle-btn svg {
    flex-shrink: 0;
}

.filter-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #673ab7;
    color: white;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
}

/* Filter panel */
.filter-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: #fafafa;
    border-bottom: 1px solid #e8e8e8;
    padding: 0 20px;
}

.filter-panel.open {
    max-height: 400px;
    padding: 20px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.filter-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #5f6368;
    margin-bottom: 6px;
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Roboto', Arial, sans-serif;
    color: #3c4043;
    background: white;
    transition: border-color 0.15s;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #673ab7;
    box-shadow: 0 0 0 2px rgba(103, 58, 183, 0.12);
}

.filter-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e8e8e8;
}

/* Filter chips */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-bottom: 1px solid #e8e8e8;
    background: #fefcff;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #ede7f6;
    color: #5e35a1;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.chip a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(103, 58, 183, 0.15);
    color: #5e35a1;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    transition: background 0.15s;
}

.chip a:hover {
    background: rgba(103, 58, 183, 0.3);
}

.chip-clear {
    font-size: 11px;
    color: #5f6368;
    text-decoration: none;
    margin-left: 4px;
}

.chip-clear:hover {
    color: #d93025;
    text-decoration: underline;
}

/* Table */
.table-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #fafafa;
    border-bottom: 2px solid #e0e0e0;
}

.data-table th {
    padding: 11px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #5f6368;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    color: #3c4043;
}

.data-table tbody tr {
    transition: background 0.1s;
}

.data-table tbody tr:hover {
    background: #f8f4fc;
}

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

.data-table .row-num {
    color: #9aa0a6;
    font-size: 12px;
    min-width: 32px;
}

.data-table .nowrap {
    white-space: nowrap;
}

.data-table .empty-state {
    text-align: center;
    padding: 48px 16px;
    color: #9aa0a6;
    font-size: 14px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-purple { background: #f3e8fd; color: #7b1fa2; }
.badge-blue   { background: #e3f2fd; color: #1565c0; }
.badge-green  { background: #e8f5e9; color: #2e7d32; }
.badge-orange { background: #fff3e0; color: #e65100; }

/* Audit log details row */
.details-row td {
    background: #fafafa;
    padding: 0 16px 12px 16px;
}

.details-content {
    padding: 8px 0;
}

.changes-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.changes-table th {
    text-align: left;
    padding: 6px 12px;
    background: #f0f0f0;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #5f6368;
    border-bottom: 1px solid #e0e0e0;
}

.changes-table td {
    padding: 6px 12px;
    border-bottom: 1px solid #f0f0f0;
    color: #3c4043;
}

.changes-table td strong {
    text-transform: capitalize;
}

/* Action buttons in tables */
.action-buttons {
    display: flex;
    gap: 6px;
}

/* Table footer — pagination bar */
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid #e8e8e8;
    background: #fafafa;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-left,
.footer-center,
.footer-right {
    display: flex;
    align-items: center;
}

.footer-center {
    flex: 1;
    justify-content: center;
}

/* Page size selector */
.page-size-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #5f6368;
    white-space: nowrap;
}

.page-size-select {
    padding: 5px 8px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Roboto', Arial, sans-serif;
    color: #3c4043;
    background: white;
    cursor: pointer;
}

.page-size-select:focus {
    outline: none;
    border-color: #673ab7;
}

/* "Showing X-Y of Z" */
.showing-text {
    font-size: 12px;
    color: #5f6368;
    white-space: nowrap;
}

/* Pagination controls */
.pagination {
    display: flex;
    align-items: center;
    gap: 2px;
}

.pg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    text-decoration: none;
    color: #3c4043;
    font-size: 12px;
    font-weight: 500;
    background: white;
    transition: all 0.15s;
    cursor: pointer;
}

.pg-btn:hover:not(.disabled):not(.pg-current) {
    background: #f3f0fa;
    border-color: #c4b5d9;
    color: #673ab7;
}

.pg-current {
    background: #673ab7;
    color: white;
    border-color: #673ab7;
    cursor: default;
}

.pg-btn.disabled {
    pointer-events: none;
    color: #dadce0;
    border-color: #eee;
    background: #fafafa;
}

.pg-btn.disabled svg {
    stroke: #dadce0;
}

.pg-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 32px;
    color: #9aa0a6;
    font-size: 12px;
    user-select: none;
}

.pg-first, .pg-prev, .pg-next, .pg-last {
    padding: 0;
    min-width: 32px;
}

/* Detail view */
.detail-container {
    max-width: 800px;
    margin: 24px auto;
    padding: 0 16px;
}

.detail-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    padding: 24px 32px;
    margin-bottom: 16px;
}

.detail-card h2 {
    font-size: 18px;
    font-weight: 500;
    color: #673ab7;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.detail-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 500;
    color: #5f6368;
    width: 200px;
    flex-shrink: 0;
}

.detail-value {
    color: #202124;
}

/* Responsive */
@media (max-width: 900px) {
    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .toolbar-actions {
        justify-content: space-between;
    }
    .search-input-wrap {
        max-width: 100%;
    }
    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .table-footer {
        flex-direction: column;
        align-items: center;
    }
    .footer-left, .footer-center, .footer-right {
        justify-content: center;
    }
}

@media (max-width: 680px) {
    .admin-container {
        padding: 0 12px;
    }

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

    .card-body {
        padding: 16px 20px;
    }

    .form-section {
        padding: 16px 20px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .detail-row {
        flex-direction: column;
    }

    .detail-label {
        width: auto;
        margin-bottom: 4px;
    }
}
