/* Form Card */
.form-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 87, 198, 0.07);
    padding: 2rem;
    margin-bottom: 2.5rem;
}

.form-card h2 {
    font-family: 'Tajawal', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--blue);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

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

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input, textarea, select {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text);
    font-family: 'Cairo', sans-serif;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    outline: none;
    direction: rtl;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 135, 198, 0.15);
}

textarea {
    resize: vertical;
    min-height: 90px;
}

select option {
    background: var(--white);
    color: var(--text);
}

#priceField {
    display: none;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.8rem;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    white-space: nowrap;
    line-height: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--sky), var(--blue));
    color: white;
    box-shadow: 0 4px 15px rgba(0, 182, 231, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 182, 231, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, #00c896, #00a878);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 200, 150, 0.35);
}

.btn-success:hover {
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: #555;
}

.btn-detail {
    background: linear-gradient(135deg, var(--orange), var(--fire));
    color: white;
    box-shadow: 0 4px 12px rgba(246, 138, 41, 0.4);
}

.btn-detail:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(246, 138, 41, 0.6);
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    border-radius: 50px;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

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

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Search and Filters */
.search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2.5rem;
    background: var(--white);
    padding: 1.2rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 87, 198, 0.05);
}

.search-bar input {
    flex: 1;
    min-width: 250px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem 1.2rem;
    font-size: 1rem;
}

.filter-btn {
    padding: 0.7rem 1.2rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text-muted);
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.filter-btn.active {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
    box-shadow: 0 4px 12px rgba(0, 135, 198, 0.3);
}

/* Courses Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.course-card {
    background: var(--white);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    position: relative;
}

.course-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 87, 198, 0.12);
    border-color: var(--sky);
}

.course-card.full {
    opacity: 0.95;
}

.card-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    border-bottom: 1px solid var(--bg);
}

.teacher-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.card-title-block {
    flex: 1;
}

.card-title {
    font-family: 'Tajawal', sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--navy);
    line-height: 1.3;
    margin-bottom: 0.2rem;
}

.card-teacher {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.card-body {
    padding: 1.5rem;
    flex: 1;
}

.card-desc {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 3rem;
}

.card-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text);
    background: var(--bg);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-weight: 600;
}

.seats-bar {
    margin-top: 1rem;
}

.seats-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.seats-label .count {
    color: var(--blue);
}

.seats-label .count.warning { color: var(--gold); }
.seats-label .count.danger { color: var(--fire); }

.progress-track {
    height: 8px;
    background: var(--bg);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s ease-in-out;
}

.progress-fill.safe { background: linear-gradient(90deg, #00c896, #00a878); }
.progress-fill.warning { background: linear-gradient(90deg, #FFB43C, #F68A29); }
.progress-fill.danger { background: linear-gradient(90deg, #FF6700, #ff4757); }

.card-footer {
    padding: 1.2rem 1.5rem;
    background: var(--bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
}

.price-tag {
    font-family: 'Tajawal', sans-serif;
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--navy);
}

.price-tag.free {
    color: var(--success);
}

.price-tag.paid {
    color: var(--orange);
}

.full-label {
    background: rgba(255, 71, 87, 0.1);
    color: var(--danger);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 800;
    border: 1px solid var(--danger);
}

/* Image Upload */
.img-upload-area {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.img-upload-area:hover {
    border-color: var(--blue);
    background: rgba(245, 166, 35, 0.05);
}

.img-upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    border: none;
    background: none;
    padding: 0;
}

.img-upload-area .icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.img-upload-area p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.img-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 0.5rem;
    display: block;
    border: 3px solid var(--gold2);
}

/* Section Title */
.section-title {
    font-family: 'Tajawal', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
}

/* Courses Table */
.courses-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.courses-table thead th {
    text-align: right;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.courses-table tbody tr {
    background: var(--white);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.courses-table tbody tr:hover {
    background: var(--bg);
    transform: translateX(-3px);
}

.courses-table td {
    padding: 1rem;
    vertical-align: middle;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.courses-table td:first-child {
    border-right: 1px solid var(--border);
    border-radius: 0 10px 10px 0;
}

.courses-table td:last-child {
    border-left: 1px solid var(--border);
    border-radius: 10px 0 0 10px;
}

.teacher-cell {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.teacher-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.teacher-name {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-free {
    background: rgba(0, 200, 150, 0.15);
    color: var(--free);
    border: 1px solid rgba(0, 200, 150, 0.3);
}

.badge-paid {
    background: rgba(245, 166, 35, 0.15);
    color: var(--paid);
    border: 1px solid rgba(245, 166, 35, 0.3);
}

.badge-full {
    background: rgba(255, 71, 87, 0.15);
    color: var(--danger);
    border: 1px solid rgba(255, 71, 87, 0.3);
}

.badge-open {
    background: rgba(76, 201, 240, 0.15);
    color: #4cc9f0;
    border: 1px solid rgba(76, 201, 240, 0.3);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 47, 88, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    padding: 2.5rem;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalSlide 0.4s ease;
}

.modal h2 {
    font-family: 'Tajawal', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--navy);
    text-align: center;
}

.modal-course-info {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.modal-course-info .course-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--blue);
    margin-bottom: 0.3rem;
}

.modal-course-info .course-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.modal-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
}

.modal-actions .btn {
    flex: 1;
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Course Detail Modal Extra */
.course-detail-modal {
    max-width: 700px;
    padding: 0;
    overflow: hidden;
}

.cdm-header {
    background: linear-gradient(135deg, var(--navy), var(--blue));
    padding: 2.5rem 2rem;
    position: relative;
}

.close-detail-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.close-detail-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.cdm-header-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.cdm-teacher-img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.2);
    object-fit: cover;
    background: white;
}

.cdm-course-name {
    color: white;
    font-size: 1.6rem;
    font-weight: 800;
    font-family: 'Tajawal', sans-serif;
    margin-bottom: 0.3rem;
}

.cdm-teacher-name {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    font-weight: 500;
}

.cdm-body {
    padding: 2.5rem;
    max-height: 75vh;
    overflow-y: auto;
}

.cdm-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
    margin-bottom: 2.5rem;
}

.cdm-stat-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    transition: transform 0.2s;
}

.cdm-stat-box:hover {
    transform: translateY(-2px);
    border-color: var(--sky);
}

.cdm-stat-box .val {
    font-size: 1.6rem;
    font-weight: 900;
    font-family: 'Tajawal', sans-serif;
}

.cdm-stat-box .lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.cdm-progress-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem;
    text-align: center;
    grid-column: 1 / -1;
}

.cdm-section-title {
    font-family: 'Tajawal', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 1.2rem;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-right: 4px solid var(--sky);
    padding-right: 0.8rem;
}

.cdm-desc-text {
    font-size: 1rem;
    line-height: 1.8;
    color: #4a5a6a;
    margin-bottom: 2.5rem;
    white-space: pre-line;
    background: #fdfdfd;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
}

.cdm-registrants-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.registrant-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.8rem 1.2rem;
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.registrant-item:hover {
    border-color: var(--blue);
    background: var(--bg);
}

.registrant-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sky), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.registrant-info {
    flex: 1;
    min-width: 0;
}

.registrant-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--navy);
}

.registrant-contact {
    font-size: 0.8rem;
    color: var(--text-muted);
    direction: ltr;
    text-align: right;
}

.registrant-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.cdm-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
