/* ===== admin.css ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, sans-serif;
}

body {
    background: #f4f6fa;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
}

.app {
    max-width: 1400px;
    width: 100%;
}

/* Login */
.login-box {
    max-width: 420px;
    margin: 4rem auto;
    background: white;
    padding: 2.5rem 2rem;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    text-align: center;
}

.login-box h2 {
    margin-bottom: 0.5rem;
    color: #1a1a2e;
}

.login-box p {
    color: #8d99ae;
    margin-bottom: 2rem;
}

.login-box input {
    width: 100%;
    padding: 0.9rem 1.2rem;
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 60px;
    font-size: 1rem;
    background: #f8fafc;
    transition: 0.2s;
}

.login-box input:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67,97,238,0.15);
}

.login-box .btn-login {
    width: 100%;
    padding: 0.9rem;
    background: #4361ee;
    border: none;
    color: white;
    font-weight: 600;
    border-radius: 60px;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 8px 20px rgba(67,97,238,0.25);
}

.login-box .btn-login:hover {
    background: #3a0ca3;
    transform: translateY(-2px);
}

.login-error {
    color: #e53e3e;
    margin-top: 0.8rem;
    font-size: 0.9rem;
}

/* Dashboard */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2.5rem;
    background: white;
    padding: 1.2rem 2rem;
    border-radius: 60px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.03);
}

.admin-header h1 {
    font-size: 1.6rem;
    color: #1a1a2e;
}

.admin-header h1 i {
    color: #f72585;
    margin-right: 0.5rem;
}

.admin-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn-outline-sm {
    background: transparent;
    border: 1.5px solid #e2e8f0;
    padding: 0.5rem 1.2rem;
    border-radius: 40px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    color: #2b2d42;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-outline-sm:hover {
    border-color: #4361ee;
    color: #4361ee;
}

.btn-primary-sm {
    background: #4361ee;
    border: none;
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 40px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 4px 12px rgba(67,97,238,0.2);
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary-sm:hover {
    background: #3a0ca3;
    transform: translateY(-2px);
}

/* Add form */
.add-form {
    background: white;
    padding: 2rem 2rem 2.2rem;
    border-radius: 28px;
    margin-bottom: 2.5rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.02);
    display: none;
}

.add-form.open {
    display: block;
}

.add-form h3 {
    margin-bottom: 1.2rem;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 2rem;
}

.form-row .full {
    grid-column: 1 / -1;
}

.add-form label {
    font-weight: 500;
    font-size: 0.9rem;
    color: #2b2d42;
    display: block;
    margin-bottom: 0.3rem;
}

.add-form input,
.add-form textarea {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 40px;
    font-size: 0.95rem;
    background: #fafbfc;
    transition: 0.2s;
}

.add-form input:focus,
.add-form textarea:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67,97,238,0.1);
}

.add-form textarea {
    border-radius: 20px;
    resize: vertical;
    min-height: 70px;
}

.submit-row {
    display: flex;
    gap: 1rem;
    margin-top: 1.2rem;
    align-items: center;
    flex-wrap: wrap;
}

.submit-row button {
    padding: 0.7rem 2.5rem;
    border: none;
    background: #4361ee;
    color: white;
    font-weight: 600;
    border-radius: 60px;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 6px 16px rgba(67,97,238,0.2);
    font-size: 0.95rem;
}

.submit-row button:hover {
    background: #3a0ca3;
}

.submit-row .cancel-btn {
    background: #e2e8f0;
    color: #1a1a2e;
    box-shadow: none;
}

.submit-row .cancel-btn:hover {
    background: #cbd5e1;
}

/* Course grid */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.course-card-admin {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.04);
    transition: 0.25s;
    display: flex;
    flex-direction: column;
}

.course-card-admin:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 35px rgba(0,0,0,0.08);
}

.course-card-admin .img-wrap {
    height: 160px;
    background: #eef2f7;
    position: relative;
    overflow: hidden;
}

.course-card-admin .img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.course-card-admin .badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #f72585;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 1rem;
    border-radius: 40px;
    letter-spacing: 0.3px;
}

.course-card-admin .body {
    padding: 1.5rem 1.5rem 1.2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.course-card-admin .body h3 {
    font-size: 1.2rem;
    margin-bottom: 0.4rem;
    color: #1a1a2e;
}

.course-card-admin .body .desc {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-card-admin .body .meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #8d99ae;
    border-top: 1px solid #edf2f7;
    padding-top: 0.8rem;
    margin-top: 0.3rem;
}

.course-card-admin .body .actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.course-card-admin .body .actions a {
    font-size: 0.85rem;
    background: #4361ee;
    color: white;
    padding: 0.3rem 1.2rem;
    border-radius: 40px;
    text-decoration: none;
    font-weight: 500;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.course-card-admin .body .actions a:hover {
    background: #3a0ca3;
}

.course-card-admin .body .actions .del-btn {
    background: #e53e3e;
    border: none;
    color: white;
    padding: 0.3rem 1.2rem;
    border-radius: 40px;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.85rem;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.course-card-admin .body .actions .del-btn:hover {
    background: #c53030;
}

.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: #8d99ae;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #cbd5e1;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: #8d99ae;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #1a1a2e;
    color: white;
    padding: 1rem 2rem;
    border-radius: 60px;
    font-weight: 500;
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
    transform: translateY(80px);
    opacity: 0;
    transition: 0.35s ease;
    z-index: 999;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Responsive */
@media (max-width: 700px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    .admin-header {
        flex-direction: column;
        align-items: stretch;
        border-radius: 30px;
        padding: 1.2rem;
    }
    .admin-actions {
        justify-content: center;
    }
    .login-box {
        margin: 2rem 1rem;
        padding: 2rem 1.5rem;
    }
}