/* Module Components */

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.module-container {
    animation: slideUp 0.3s ease-out;
    max-width: 1200px;
    margin: 0 auto;
}

/* Cards */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1.05rem;
    /* Increased from 0.9rem */
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.btn-primary i {
    font-size: 1.2rem;
    /* Icon size */
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Action Buttons Bar */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .action-buttons {
        width: 100%;
        margin-top: 1rem;
    }

    .action-buttons button {
        flex: 1;
        /* Make buttons grow to fill space on mobile */
        justify-content: center;
        min-width: 120px;
        /* Prevent them getting too small */
    }
}

.btn-secondary {
    background-color: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 1.05rem;
    /* Increased */
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-secondary i {
    font-size: 1.2rem;
}

.btn-secondary:hover {
    background-color: var(--bg-body);
    border-color: #cbd5e1;
}

/* Forms */
.form-grid {
    display: grid;
    /* Use auto-fit with a smaller minmax for mobile */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (max-width: 480px) {
    .form-grid {
        grid-template-columns: 1fr;
        /* Stack vertically on very small screens */
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        /* Full width buttons */
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .form-grid {
        display: grid;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.75rem;
    }

    /* Full width items on mobile */
    .fg-full {
        grid-column: 1 / -1 !important;
    }

    /* Half width items on mobile (default 1 span) */
    .fg-half {
        grid-column: span 1 !important;
    }

    /* Forced full width for section headers */
    .fg-student-header {
        grid-column: 1 / -1 !important;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    /* Ensure it fits parent */
    box-sizing: border-box;
    /* Include padding in width */
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    background-color: var(--bg-surface);
    outline: none;
    transition: var(--transition);
    min-width: 0;
    /* Allow shrinking in flex/grid */
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    text-align: left;
    padding: 1rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    background-color: #f8fafc;
    /* subtle header bg */
}

.data-table td {
    padding: 1.25rem 1.5rem;
    font-size: 1.05rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background-color: #f8fafc;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active {
    background-color: var(--success-bg);
    color: var(--success-text);
}

.status-inactive {
    background-color: var(--danger-bg);
    color: var(--danger-text);
}

/* Action Buttons (Table) */
.action-btn {
    background: none;
    border: none;
    padding: 0.4rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    margin-right: 0.5rem;
    font-size: 1.2rem;
    /* Size for button container if text */
}

.action-btn i {
    font-size: 1.3rem;
    /* Actual icon size */
}

.action-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

/* File/Folder Tree Styles */
.folder-tree {
    padding-right: 0.5rem;
}

.folder-item {
    font-size: 0.9rem;
    color: var(--text-primary);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.folder-item:hover {
    background-color: #f1f5f9;
}

.folder-item.selected {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1.5rem;
}

/* Atas Page Layout */
.atas-layout {
    display: flex;
    gap: 1.5rem;
    height: calc(100vh - 220px);
    /* Fixed height to allow internal scrolling */
}

.atas-sidebar {
    width: 250px;
    /* Narrower sidebar */
    min-width: 200px;
    overflow-y: auto;
    flex-shrink: 0;
    /* Prevent shrinking */
}

.atas-content {
    flex: 1;
    /* Take remaining width */
    overflow-y: auto;
    min-width: 0;
    /* Important for scroll */
}

/* Responsive Atas */
@media (max-width: 768px) {
    .atas-layout {
        flex-direction: column;
        height: auto;
    }

    .atas-sidebar {
        width: 100%;
        height: 200px;
        /* Shorter fixed height on mobile */
    }

    .atas-content {
        height: 500px;
        /* Fixed height or auto on mobile */
    }
}

.file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: var(--transition);
    cursor: pointer;
}

.file-item:hover {
    background-color: #f8fafc;
    border-color: var(--border-color);
}