/* ========================================
   Admin Styles
   ======================================== */
.admin-body {
    background-color: #f8f9fa;
    color: #212529;
    min-height: 100vh;
    display: flex;
}

/* Sidebar */
.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 220px;
    background: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.admin-brand {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.admin-brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: white;
}

.admin-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.admin-title {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

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

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
}

.admin-nav-link svg {
    flex-shrink: 0;
}

.admin-nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.admin-nav-link.active {
    background: rgba(255,255,255,0.12);
    color: white;
    border-right: 3px solid var(--accent, #dcaf4d);
}

/* Sidebar footer */
.admin-sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: auto;
}

.admin-user-name {
    display: block;
    color: rgba(255,255,255,0.9);
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
}

.admin-sidebar-links {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.admin-link {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 0.75rem;
}

.admin-link:hover {
    color: white;
}

.admin-logout-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.8);
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.admin-logout-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.4);
    color: white;
}

/* Mobile toggle */
.admin-mobile-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 101;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Main content */
.admin-main {
    margin-left: 220px;
    padding: 1rem 0 2rem;
    min-height: 100vh;
    flex: 1;
}

.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.admin-flash {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.admin-flash-notice {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

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

.admin-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.admin-page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.admin-page-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-admin-primary {
    background: var(--primary);
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-admin-primary:hover {
    background: var(--primary-light);
}

.btn-admin-secondary {
    background: white;
    color: var(--primary);
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-admin-secondary:hover {
    background: #f8f9fa;
}

.btn-admin-small {
    background: white;
    color: var(--primary);
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-admin-small:hover {
    background: #f8f9fa;
}

.btn-admin-danger {
    color: #dc3545;
    border-color: #dc3545;
}

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

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

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

.admin-table th {
    background: #f8f9fa;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
}

.admin-table td {
    font-size: 0.875rem;
    color: #212529;
}

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

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

.admin-table tbody tr.highlight {
    background: rgba(220, 175, 77, 0.15);
    font-weight: 600;
    border-left: 3px solid var(--accent, #dcaf4d);
}

.admin-table tbody tr.highlight td {
    color: var(--primary);
}

.admin-table tbody tr.highlight:hover {
    background: rgba(220, 175, 77, 0.25);
}

.admin-table code {
    background: #e9ecef;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.admin-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.status-badge.published {
    background: #d4edda;
    color: #155724;
}

.status-badge.draft {
    background: #fff3cd;
    color: #856404;
}

.admin-empty {
    text-align: center;
    padding: 3rem;
    color: var(--muted-foreground);
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* Pagy pagination */
nav.pagy.series-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
    padding: 1rem 0;
}

nav.pagy.series-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid var(--border);
    background: white;
    color: var(--foreground);
    transition: all 0.15s ease;
}

nav.pagy.series-nav a:hover:not([aria-disabled="true"]) {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

nav.pagy.series-nav a[aria-current="page"] {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

nav.pagy.series-nav a[aria-disabled="true"] {
    opacity: 0.4;
    pointer-events: none;
}

.admin-form {
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 2rem;
    max-width: 800px;
}

.admin-form-errors {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.admin-form-errors h3 {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.admin-form-errors ul {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.875rem;
}

.admin-form-group {
    margin-bottom: 1.5rem;
}

.admin-form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #212529;
    margin-bottom: 0.5rem;
}

.admin-input,
.admin-select,
.admin-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    color: #212529;
    background: white;
    transition: border-color 0.2s;
}

.admin-input:focus,
.admin-select:focus,
.admin-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(3, 35, 116, 0.1);
}

.admin-textarea {
    resize: vertical;
    min-height: 100px;
}

.admin-help {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.8rem;
    color: var(--muted-foreground);
}

.admin-form-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.admin-detail {
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 2rem;
}

.admin-detail-row {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.admin-detail-row:last-of-type {
    border-bottom: none;
}

.admin-detail-row strong {
    min-width: 150px;
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.admin-detail-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.admin-detail-section strong {
    display: block;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.admin-content-preview {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 6px;
    font-size: 0.875rem;
    line-height: 1.7;
}

.admin-content-preview p {
    margin-bottom: 1rem;
}

.admin-content-preview p:last-child {
    margin-bottom: 0;
}

/* Detail card with photo */
.admin-detail-card {
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 2rem;
}

.admin-detail-photo-section {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.admin-detail-photo {
    width: 150px;
    height: 150px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
}

.admin-detail-photo-placeholder {
    width: 150px;
    height: 150px;
    border-radius: 12px;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.admin-detail-info p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.admin-season-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-season-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.admin-season-list li:last-child {
    border-bottom: none;
}

.admin-empty-text {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

/* Section title */
.admin-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

/* Inline form card for add player form */
.admin-inline-form-card {
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-inline-form-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0 0 1rem 0;
}

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

.admin-form-group-small {
    flex: 0 0 100px;
}

.admin-form-group-submit {
    flex: 0 0 auto;
}

.admin-form-group-submit .btn-admin-primary {
    margin-bottom: 1.5rem;
}

/* Table wrapper for horizontal scroll */
.admin-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

/* Table photo styling */
.admin-table-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.admin-table-photo-placeholder {
    display: inline-block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ddd;
    text-align: center;
    line-height: 40px;
    color: #666;
}

.admin-table-subtext {
    color: var(--muted-foreground);
    font-size: 0.8rem;
}

.admin-table-input {
    width: 60px;
    padding: 4px 8px;
}

.admin-table-checkbox {
    margin-right: 0.5rem;
}

.admin-table-checkbox-label {
    font-size: 0.875rem;
    cursor: pointer;
}


/* Search form */
.admin-search-form {
    margin-bottom: 1.5rem;
}

.admin-search-input {
    max-width: 400px;
}

/* Sortable headers */
.sortable-header {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    text-decoration: none;
    color: var(--muted-foreground);
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color 0.15s;
}

.sortable-header:hover {
    color: var(--primary);
}

.sortable-header.active {
    color: var(--primary);
}

/* ========================================
   Admin Mobile Responsive Styles
   ======================================== */
@media (max-width: 768px) {
    .admin-body {
        display: block;
    }

    /* Sidebar - hidden by default on mobile */
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: none;
    }

    .admin-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.2);
    }

    .admin-mobile-toggle {
        display: block;
    }

    /* Main content - full width on mobile */
    .admin-main {
        margin-left: 0;
        padding-top: 3.5rem;
        padding-bottom: 1.5rem;
    }

    .admin-container {
        padding: 0 1rem;
    }

    /* Page header */
    .admin-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .admin-page-header h1 {
        font-size: 1.5rem;
    }

    .admin-page-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .btn-admin-primary,
    .btn-admin-secondary {
        flex: 1;
        min-width: 120px;
        text-align: center;
    }

    /* Tables - transform to card view on mobile */
    .admin-table-wrapper {
        display: block;
        overflow-x: visible;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
    }

    .admin-table {
        display: block;
        min-width: auto;
        border: none;
        background: transparent;
    }

    .admin-table thead {
        display: none;
    }

    .admin-table tbody {
        display: block;
    }

    .admin-table tr {
        display: block;
        background: white;
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }

    .admin-table tr:last-child {
        margin-bottom: 0;
    }

    .admin-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border: none;
        font-size: 0.9rem;
    }

    .admin-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--muted-foreground);
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 0.02em;
        margin-right: 1rem;
        flex-shrink: 0;
    }

    .admin-table td:not([data-label])::before {
        display: none;
    }

    /* Table elements in card view */
    .admin-table-photo {
        width: 48px;
        height: 48px;
    }

    .admin-table-photo-placeholder {
        width: 48px;
        height: 48px;
        line-height: 48px;
    }

    .admin-table-subtext {
        display: block;
        margin-top: 0.25rem;
    }

    .admin-table-input {
        width: 70px;
        padding: 0.5rem;
    }

    .admin-table-checkbox {
        width: auto;
        margin: 0 0.5rem 0 0;
    }

    .admin-table-checkbox-label {
        font-size: 0.9rem;
    }

    /* Actions in tables */
    .admin-actions {
        flex-direction: column;
        gap: 0.375rem;
    }

    .btn-admin-small {
        width: 100%;
        text-align: center;
        padding: 0.5rem 0.75rem;
    }

    /* Forms */
    .admin-form {
        padding: 1.25rem;
        max-width: 100%;
    }

    .admin-form-group {
        margin-bottom: 1.25rem;
    }

    .admin-input,
    .admin-select,
    .admin-textarea {
        padding: 0.75rem;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    /* Grid layouts in forms */
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    .admin-current-image img {
        max-width: 100px !important;
        max-height: 100px !important;
    }

    /* Detail pages */
    .admin-detail {
        padding: 1.25rem;
    }

    .admin-detail-row {
        flex-direction: column;
        gap: 0.25rem;
        padding: 0.625rem 0;
    }

    .admin-detail-row strong {
        min-width: auto;
        font-size: 0.8rem;
    }

    .admin-detail-section {
        margin-top: 1.25rem;
        padding-top: 1.25rem;
    }

    .admin-content-preview {
        padding: 1rem;
        font-size: 0.85rem;
    }

    /* Detail card with photo */
    .admin-detail-card {
        padding: 1.25rem;
    }

    .admin-detail-card > div[style*="display: flex"] {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center;
    }

    .admin-detail-card img {
        width: 120px !important;
        height: 120px !important;
    }

    .admin-detail-card p {
        font-size: 0.9rem;
    }

    /* Status badges */
    .status-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    /* Empty state */
    .admin-empty {
        padding: 2rem 1rem;
    }

    /* Flash messages */
    .admin-flash {
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }

    /* Detail photo section */
    .admin-detail-photo-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .admin-detail-photo,
    .admin-detail-photo-placeholder {
        width: 120px !important;
        height: 120px !important;
    }

    .admin-detail-info p {
        font-size: 0.85rem;
    }

    /* Inline form card */
    .admin-inline-form-card {
        padding: 1rem;
    }

    .admin-inline-form {
        flex-direction: column;
        gap: 1rem;
    }

    .admin-form-group-small {
        flex: 1 1 auto;
    }

    .admin-form-group-submit {
        flex: 1 1 auto;
    }

    .admin-form-group-submit .btn-admin-primary {
        width: 100%;
        margin-bottom: 0;
    }

    /* Section title */
    .admin-section-title {
        font-size: 1.1rem;
        margin-top: 1.5rem;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .admin-page-header h1 {
        font-size: 1.25rem;
    }

    .admin-form,
    .admin-detail,
    .admin-detail-card,
    .admin-inline-form-card {
        padding: 1rem;
    }

    .btn-admin-primary,
    .btn-admin-secondary {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }

    .admin-detail-photo,
    .admin-detail-photo-placeholder {
        width: 100px !important;
        height: 100px !important;
    }

    .admin-detail-info p {
        font-size: 0.8rem;
    }
}

