/* ========================================
   Turath College Portal - Components
   ======================================== */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    border-radius: var(--radius);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--primary);
    color: var(--white);
}

.btn-secondary {
    background-color: var(--gray-100);
    color: var(--text-primary);
    border-color: var(--gray-100);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--gray-200);
    border-color: var(--gray-200);
}

[data-theme="dark"] .btn-secondary {
    background-color: var(--gray-700);
    border-color: var(--gray-700);
    color: var(--gray-100);
}

[data-theme="dark"] .btn-secondary:hover {
    background-color: var(--gray-600);
    border-color: var(--gray-600);
}

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

.btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
    border-color: #dc2626;
}

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

.btn-success:hover:not(:disabled) {
    background-color: #16a34a;
    border-color: #16a34a;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
}

.btn-block {
    width: 100%;
}

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

.btn-white:hover:not(:disabled) {
    background-color: var(--gray-100);
    border-color: var(--gray-100);
}

/* Form Elements */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-label.required::after {
    content: '*';
    color: var(--error);
    margin-left: 0.25rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: all var(--transition);
}

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

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: var(--error);
}

.form-error {
    font-size: 0.75rem;
    color: var(--error);
    margin-top: 0.25rem;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

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

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

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

@media (min-width: 640px) {
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

.form-row-3 {
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .form-row-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Password Input */
.password-input-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
}

.password-toggle:hover {
    color: var(--text-primary);
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-check-input {
    width: 1.125rem;
    height: 1.125rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    accent-color: var(--primary);
}

.form-check-label {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-hover {
    transition: transform var(--transition), box-shadow var(--transition);
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-bordered {
    border: 1px solid var(--border-color);
    box-shadow: none;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.card-header-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.card-header-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--gray-50);
}

[data-theme="dark"] .card-footer {
    background-color: rgba(0, 0, 0, 0.2);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
}

.status-pending {
    background-color: rgba(234, 179, 8, 0.1);
    color: #b45309;
}

.status-approved,
.status-active {
    background-color: rgba(34, 197, 94, 0.1);
    color: #15803d;
}

.status-rejected {
    background-color: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
}

.status-suspended {
    background-color: rgba(107, 114, 128, 0.1);
    color: #4b5563;
}

[data-theme="dark"] .status-pending {
    background-color: rgba(234, 179, 8, 0.2);
    color: #fbbf24;
}

[data-theme="dark"] .status-approved,
[data-theme="dark"] .status-active {
    background-color: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

[data-theme="dark"] .status-rejected {
    background-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

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

.table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background-color: var(--gray-50);
}

[data-theme="dark"] .table th {
    background-color: rgba(0, 0, 0, 0.2);
}

.table tbody tr:hover {
    background-color: var(--gray-50);
}

[data-theme="dark"] .table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.table td {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
    gap: 0.5rem;
    overflow-x: auto;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    transition: color var(--transition);
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: transparent;
    transition: background-color var(--transition);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    background-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-lg {
    max-width: 800px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.5rem;
    transition: all var(--transition);
}

.modal-close:hover {
    background-color: var(--gray-100);
    color: var(--text-primary);
}

[data-theme="dark"] .modal-close:hover {
    background-color: var(--gray-700);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--gray-50);
}

[data-theme="dark"] .modal-footer {
    background-color: rgba(0, 0, 0, 0.2);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background-color: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition);
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-btn.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Alert */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.alert i {
    font-size: 1.25rem;
    margin-top: 0.125rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.alert-text {
    font-size: 0.875rem;
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--info);
}

.alert-success {
    background-color: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.alert-warning {
    background-color: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.2);
    color: #b45309;
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--error);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

.spinner-white {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

[data-theme="dark"] .loading-overlay {
    background-color: rgba(0, 0, 0, 0.9);
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background-color: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition);
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color var(--transition);
}

.dropdown-item:hover {
    background-color: var(--gray-50);
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.dropdown-item i {
    width: 1rem;
    text-align: center;
    color: var(--text-muted);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.5rem 0;
}

/* Progress Bar */
.progress {
    height: 8px;
    background-color: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

[data-theme="dark"] .progress {
    background-color: var(--gray-700);
}

.progress-bar {
    height: 100%;
    background-color: var(--primary);
    border-radius: var(--radius-full);
    transition: width var(--transition);
}

/* Avatar */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background-color: rgba(0, 107, 60, 0.1);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.875rem;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }
.avatar-xl { width: 64px; height: 64px; font-size: 1.25rem; }

/* Search Input */
.search-wrapper {
    position: relative;
}

.search-wrapper .form-input {
    padding-left: 2.5rem;
}

.search-wrapper i {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Sidebar Navigation */
.sidebar-nav {
    width: 250px;
    background-color: var(--card-bg);
    border-right: 1px solid var(--border-color);
    min-height: calc(100vh - 70px);
    padding: 1.5rem 0;
}

.sidebar-nav-section {
    margin-bottom: 1.5rem;
}

.sidebar-nav-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0 1.5rem;
    margin-bottom: 0.5rem;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.sidebar-nav-item:hover {
    color: var(--primary);
    background-color: rgba(0, 107, 60, 0.05);
}

.sidebar-nav-item.active {
    color: var(--primary);
    background-color: rgba(0, 107, 60, 0.1);
    font-weight: 500;
}

.sidebar-nav-item i {
    width: 20px;
    text-align: center;
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    min-height: calc(100vh - 70px);
}

.dashboard-content {
    flex: 1;
    padding: 1.5rem;
    background-color: var(--gray-50);
}

[data-theme="dark"] .dashboard-content {
    background-color: var(--gray-900);
}

/* Stats Cards */
.stats-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.stats-card-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stats-card-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.stats-card-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Responsive Sidebar */
@media (max-width: 1023px) {
    .sidebar-nav {
        position: fixed;
        top: 70px;
        left: -250px;
        bottom: 0;
        z-index: 50;
        transition: left var(--transition);
    }
    
    .sidebar-nav.active {
        left: 0;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 40;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition);
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

/* File Upload */
.file-upload {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.file-upload:hover {
    border-color: var(--primary);
    background-color: rgba(0, 107, 60, 0.05);
}

.file-upload.drag-over {
    border-color: var(--primary);
    background-color: rgba(0, 107, 60, 0.1);
}

.file-upload i {
    font-size: 2.5rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.file-upload p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.file-upload input[type="file"] {
    display: none;
}

/* Stepper */
.stepper {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stepper-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stepper-number {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background-color: var(--gray-200);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.stepper-item.active .stepper-number {
    background-color: var(--primary);
    color: var(--white);
}

.stepper-item.completed .stepper-number {
    background-color: var(--success);
    color: var(--white);
}

.stepper-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.stepper-item.active .stepper-label {
    color: var(--text-primary);
    font-weight: 500;
}

.stepper-line {
    width: 40px;
    height: 2px;
    background-color: var(--gray-200);
}

.stepper-line.completed {
    background-color: var(--success);
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.switch input {
    display: none;
}

.switch-slider {
    width: 44px;
    height: 24px;
    background-color: var(--gray-300);
    border-radius: var(--radius-full);
    transition: background-color var(--transition);
    position: relative;
}

.switch-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background-color: var(--white);
    border-radius: var(--radius-full);
    top: 3px;
    left: 3px;
    transition: transform var(--transition);
}

.switch input:checked + .switch-slider {
    background-color: var(--primary);
}

.switch input:checked + .switch-slider::before {
    transform: translateX(20px);
}

.switch-label {
    margin-left: 0.75rem;
    font-size: 0.875rem;
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .header,
    .footer,
    .floating-admin-btn {
        display: none !important;
    }
    
    body {
        background: white !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}
