/* ============================================
   Admin Panel — Stylesheet
   Faculty of Graduate Studies, University of Ruhuna
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #1a237e;
    --primary-light: #3949ab;
    --primary-dark: #0d1452;
    --accent: #c9a94e;
    --accent-light: #dfc370;
    --bg: #f0f2f5;
    --bg-card: #ffffff;
    --sidebar-bg: #0f1535;
    --sidebar-hover: #1a2155;
    --text: #1a1a2e;
    --text-light: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --error: #ef4444;
    --error-bg: #fef2f2;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --info: #3b82f6;
    --info-bg: #eff6ff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Login Page ── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(201, 169, 78, 0.15) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(57, 73, 171, 0.2) 0%, transparent 70%);
    bottom: -50px;
    left: -50px;
    border-radius: 50%;
    animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-30px) scale(1.05);
    }
}

.login-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.6s ease forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    display: block;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.login-header p {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.input-icon-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
}

.input-icon-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
    background: var(--bg);
}

.input-icon-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(57, 73, 171, 0.1);
    background: white;
}

.btn-login {
    width: 100%;
    padding: 0.85rem;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(26, 35, 126, 0.3);
    margin-top: 0.5rem;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(26, 35, 126, 0.4);
}

/* ── Alert ── */
.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideUp 0.3s ease;
}

.alert-error {
    background: var(--error-bg);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-success {
    background: var(--success-bg);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* ── Admin Layout ── */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.sidebar-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-light);
}

.sidebar-header p {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.2rem;
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: var(--sidebar-hover);
    color: white;
    border-left-color: var(--accent);
}

.sidebar-nav a .nav-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    position: absolute;
    bottom: 0;
    width: 100%;
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-footer a:hover {
    color: var(--error);
}

/* Main Content */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 2rem;
    min-height: 100vh;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.page-header .header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ── Stats Cards ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
    border: 1px solid var(--border);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: var(--info-bg);
}

.stat-icon.green {
    background: var(--success-bg);
}

.stat-icon.yellow {
    background: var(--warning-bg);
}

.stat-icon.red {
    background: var(--error-bg);
}

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.stat-info p {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.2rem;
}

/* ── Filter Bar ── */
.filter-bar {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: flex-end;
    border: 1px solid var(--border);
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
    background: var(--bg);
}

.filter-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.filter-group input:focus,
.filter-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(57, 73, 171, 0.08);
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.15rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.83rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(26, 35, 126, 0.2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 35, 126, 0.3);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: none;
    border: 1.5px solid var(--border);
    color: var(--text-light);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(57, 73, 171, 0.04);
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    border-radius: 8px;
}

/* ── Data Table ── */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: white;
    padding: 0.85rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 0.85rem 1rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(57, 73, 171, 0.03);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-pending {
    background: var(--warning-bg);
    color: #92400e;
}

.badge-reviewed {
    background: var(--info-bg);
    color: #1e40af;
}

.badge-accepted {
    background: var(--success-bg);
    color: #065f46;
}

.badge-rejected {
    background: var(--error-bg);
    color: #991b1b;
}

.action-btns {
    display: flex;
    gap: 0.35rem;
}

/* ── Pagination ── */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 0 0 var(--radius) var(--radius);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.pagination-info {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.pagination {
    display: flex;
    gap: 0.3rem;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    transition: var(--transition);
    border: 1px solid var(--border);
    color: var(--text-light);
    background: white;
}

.pagination a:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(57, 73, 171, 0.05);
}

.pagination .active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination .disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ── Per-page selector ── */
.per-page-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.per-page-selector select {
    padding: 0.35rem 0.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    outline: none;
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    padding: 0.25rem;
}

.modal-close:hover {
    color: var(--error);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ── View Application Details ── */
.detail-section {
    margin-bottom: 1.5rem;
}

.detail-section h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.detail-item {
    padding: 0.5rem 0;
}

.detail-item .detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.detail-item .detail-value {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
    margin-top: 0.15rem;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
    margin-top: 0.5rem;
}

.detail-table th {
    background: var(--bg);
    padding: 0.6rem 0.75rem;
    font-weight: 600;
    text-align: left;
    font-size: 0.78rem;
    color: var(--text-light);
    border: 1px solid var(--border);
}

.detail-table td {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .sidebar {
        width: 70px;
    }

    .sidebar-header h2,
    .sidebar-header p,
    .sidebar-nav a span:not(.nav-icon),
    .sidebar-footer a span:not(.nav-icon) {
        display: none;
    }

    .sidebar-nav a {
        justify-content: center;
        padding: 1rem;
    }

    .main-content {
        margin-left: 70px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .sidebar.mobile-open {
        display: block;
        width: 260px;
        z-index: 200;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .data-table {
        font-size: 0.8rem;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 0.65rem 0.5rem;
    }
}