/**
 * Admin Interface Styles
 */

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #1d1d1f;
    background: #f5f5f7;
    margin: 0;
    padding: 0;
}

/* Header */
.admin-header {
    background: #1d1d1f;
    color: white;
    padding: 0 20px;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.admin-header h1 {
    font-size: 1.2rem;
    margin: 0;
    font-weight: 500;
}

.admin-header nav {
    display: flex;
    gap: 5px;
}

.admin-header nav a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
}

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

.admin-header nav a.active {
    background: #007AFF;
    color: white;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 20px;
    padding-left: 20px;
    border-left: 1px solid rgba(255,255,255,0.2);
}

.user-name {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

.logout-link {
    color: white;
    text-decoration: none;
    padding: 6px 14px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.logout-link:hover {
    background: rgba(255,255,255,0.2);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1d1d1f;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: #34c759;
}

.toast.error {
    background: #dc3545;
}

/* Skip Link (visible on focus) */
.skip-link {
    position: absolute;
    left: -999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    background: #007AFF;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 0 0 6px 0;
    z-index: 100;
}

.skip-link:focus {
    position: fixed;
    left: 0;
    top: 0;
    width: auto;
    height: auto;
    overflow: visible;
}

/* Main Content */
.admin-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.admin-main h2 {
    font-size: 1.5rem;
    margin: 0 0 20px;
}

/* Cards */
.card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card h3 {
    font-size: 1rem;
    margin: 0 0 15px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 600;
    color: #1d1d1f;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
    margin-top: 5px;
}

.stat-card.pending .stat-number { color: #ff9500; }
.stat-card.complete .stat-number { color: #34c759; }

/* Tables */
.sessions-table {
    width: 100%;
    border-collapse: collapse;
}

.sessions-table th,
.sessions-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
}

.sessions-table th {
    font-weight: 600;
    color: #666;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.sessions-table tbody tr:hover {
    background: #f9f9f9;
}

.sessions-table small {
    color: #888;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-pending { background: #fff3cd; color: #856404; }
.status-partial { background: #cce5ff; color: #004085; }
.status-complete { background: #d4edda; color: #155724; }
.status-expired { background: #f8d7da; color: #721c24; }
.status-pending_pdf { background: #e2e3e5; color: #383d41; }

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-small {
    display: inline-block;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary {
    background: #007AFF;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #f5f5f5;
    color: #1d1d1f;
}

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

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.actions {
    display: flex;
    gap: 8px;
}

/* Forms */
.create-form {
    max-width: 500px;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d1d6;
    border-radius: 6px;
    font-size: 15px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: #888;
    font-size: 0.85rem;
}

.form-group.checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
}

.form-group.checkbox input {
    width: auto;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

/* Filters */
.filters {
    margin-bottom: 20px;
}

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

.filter-row select,
.filter-row input {
    padding: 8px 12px;
    border: 1px solid #d1d1d6;
    border-radius: 6px;
    font-size: 14px;
}

.results-count {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

.pagination a {
    color: #007AFF;
    text-decoration: none;
}

.pagination span {
    color: #666;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Session Created */
.session-created {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.session-created h3 {
    color: #34c759;
    margin: 0 0 20px;
}

.signing-link label,
.signing-link-box label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
}

.link-box {
    display: flex;
    gap: 10px;
}

.link-box input {
    flex: 1;
    padding: 12px;
    border: 1px solid #d1d1d6;
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
}

.btn-copy {
    padding: 12px 20px;
    background: #007AFF;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.next-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

/* Session Detail */
.session-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.back-link {
    color: #007AFF;
    text-decoration: none;
    font-size: 0.9rem;
}

.session-header h2 {
    flex: 1;
    margin: 0;
}

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

dl {
    margin: 0;
}

dt {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    margin-top: 12px;
}

dt:first-child {
    margin-top: 0;
}

dd {
    margin: 4px 0 0;
    font-weight: 500;
}

.signing-link-box {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

.signing-link-box input {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d1d6;
    border-radius: 6px;
    font-family: monospace;
    font-size: 12px;
    margin-bottom: 8px;
}

/* Signatures */
.signatures-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.signature-card {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
}

.signature-card h4 {
    margin: 0 0 10px;
    font-size: 1rem;
}

/* Audit Table */
.audit-table {
    width: 100%;
    font-size: 0.85rem;
}

.audit-table th,
.audit-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e5e5e5;
}

.audit-table code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.audit-table pre {
    margin: 10px 0 0;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 0.75rem;
    overflow-x: auto;
}

.audit-table details summary {
    cursor: pointer;
    color: #007AFF;
}

/* Empty State */
.empty-state {
    color: #888;
    text-align: center;
    padding: 40px 20px;
}

.empty-state a {
    color: #007AFF;
}

.expired-text {
    color: #dc3545;
    font-size: 0.85rem;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 10px;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
}

.page-header h2 {
    margin: 0;
}

/* Data Table */
.data-table {
    width: 100%;
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-collapse: collapse;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
}

.data-table th {
    background: #f9f9f9;
    font-weight: 600;
    color: #666;
    font-size: 0.85rem;
    text-transform: uppercase;
}

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

.data-table code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    background: #f5f5f5;
    color: #1d1d1f;
}

.btn:hover {
    background: #e5e5e5;
}

.btn-primary {
    background: #007AFF;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

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

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

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-info {
    background: #cce5ff;
    color: #004085;
}

.badge-secondary {
    background: #e2e3e5;
    color: #383d41;
}

/* Admin Form */
.admin-form {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.admin-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d1d6;
    border-radius: 6px;
    font-size: 15px;
}

.admin-form textarea:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        height: auto;
        padding: 15px 0;
        gap: 10px;
    }

    .admin-header nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .user-menu {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        padding-top: 10px;
        border-top: 1px solid rgba(255,255,255,0.2);
    }

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

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

    .sessions-table {
        font-size: 0.85rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}
