/**
 * File CSS utama aplikasi Tugasin
 */

/* ---------- Reset dan Dasar ---------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: #f9f9f9;
    color: var(--dark-color);
    padding-bottom: 60px;
}

/* ---------- Container ---------- */
.container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 10px;
}

/* ---------- Header ---------- */
header {
    background-color: var(--primary-color);
    color: var(--primary-text);
    padding: 0.8rem;
    text-align: center;
    margin-bottom: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
}

.logout-btn {
    background-color: rgba(255,255,255,0.2);
    border: none;
    color: var(--primary-text);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s;
}

.logout-btn:hover {
    background-color: rgba(255,255,255,0.3);
}

/* ---------- Login ---------- */
.login-container {
    max-width: 400px;
    margin: 40px auto;
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

/* ---------- Forms ---------- */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="email"],
input[type="color"],
textarea,
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="color"]:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color), 0.2);
    outline: none;
}

textarea {
    height: 150px;
    resize: vertical;
}

/* ---------- Buttons ---------- */
button, .btn {
    background-color: var(--primary-color);
    color: var(--primary-text);
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: inline-block;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.1s;
}

button:hover, .btn:hover {
    background-color: var(--secondary-color);
}

button:active, .btn:active {
    transform: scale(0.98);
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 16px;
    font-size: 16px;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: var(--primary-text);
}

/* Button Variants */
.btn-danger {
    background-color: var(--danger-color);
    color: var(--danger-text);
}

.btn-danger:hover {
    background-color: #d32f2f;
}

.btn-warning {
    background-color: var(--warning-color);
    color: var(--warning-text);
}

.btn-warning:hover {
    background-color: #e68a00;
}

.btn-info {
    background-color: var(--info-color);
    color: var(--info-text);
}

.btn-info:hover {
    background-color: #0b7dda;
}

.btn-success {
    background-color: var(--success-color);
    color: var(--success-text);
}

.btn-success:hover {
    background-color: #3d8b3d;
}

/* ---------- Alerts ---------- */
.alert {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
    animation: fadeIn 0.3s;
}

.alert-danger {
    background-color: #ffebee;
    color: var(--danger-color);
    border: 1px solid #ffcdd2;
}

.alert-success {
    background-color: #e8f5e9;
    color: var(--success-color);
    border: 1px solid #c8e6c9;
}

.alert-warning {
    background-color: #fff8e1;
    color: var(--warning-color);
    border: 1px solid #ffecb3;
}

.alert-info {
    background-color: #e3f2fd;
    color: var(--info-color);
    border: 1px solid #b3e5fc;
}

/* ---------- Navigation ---------- */
/* Desktop Tabs */
.desktop-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 15px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.desktop-tabs::-webkit-scrollbar {
    display: none;
}

.desktop-tab {
    padding: 8px 15px;
    cursor: pointer;
    background-color: #f1f1f1;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    margin-right: 3px;
    transition: all 0.2s;
}

.desktop-tab.active {
    background-color: white;
    border-bottom: 2px solid var(--primary-color);
    font-weight: bold;
}

.desktop-tab:hover:not(.active) {
    background-color: #e9e9e9;
}

/* Mobile Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: white;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
    z-index: 1000;
}

.mobile-tabs {
    display: flex;
    justify-content: space-around;
}

.mobile-tab {
    flex: 1;
    padding: 8px 0;
    font-size: 12px;
    text-align: center;
    cursor: pointer;
    color: #777;
    transition: all 0.2s;
}

.mobile-tab.active {
    color: var(--primary-color);
    font-weight: bold;
}

.mobile-tab i {
    display: block;
    margin-bottom: 2px;
    font-size: 16px;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

/* ---------- Cards ---------- */
.card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 15px;
    margin-bottom: 15px;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.card-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.card-actions {
    display: flex;
    gap: 5px;
}

.card-body {
    position: relative;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
    margin-right: 3px;
    margin-bottom: 3px;
}

.badge-success {
    background-color: var(--success-color);
    color: var(--success-text);
}

.badge-warning {
    background-color: var(--warning-color);
    color: var(--warning-text);
}

.badge-info {
    background-color: var(--info-color);
    color: var(--info-text);
}

.badge-danger {
    background-color: var(--danger-color);
    color: var(--danger-text);
}

.badge-primary {
    background-color: var(--primary-color);
    color: var(--primary-text);
}

.badge-secondary {
    background-color: var(--secondary-color);
    color: var(--secondary-text);
}

/* ---------- Date Info ---------- */
.date-info {
    padding: 8px;
    background-color: #f9f9f9;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

/* ---------- Progress Bar ---------- */
.progress-container {
    margin-top: 10px;
    margin-bottom: 15px;
}

.progress-bar {
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    margin-top: 5px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ---------- Modals ---------- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    overflow-y: auto;
    animation: fadeIn 0.3s;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    width: 90%;
    max-width: 500px;
    margin: 20px auto;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.close {
    font-size: 24px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.close:hover {
    opacity: 1;
}

.action-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
    margin-top: 15px;
}

/* ---------- Search ---------- */
.search-box {
    margin-bottom: 15px;
    position: relative;
}

.search-box input {
    padding-left: 30px;
}

.search-box:before {
    content: '\f002';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

/* ---------- Floating Action Button ---------- */
.fab-button {
    position: fixed;
    bottom: 70px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: var(--primary-text);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    z-index: 900;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: bounce 0.5s;
}

.fab-button i {
    font-size: 24px;
}

.fab-button:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.fab-button:active {
    transform: scale(0.95);
}

/* ---------- Lists ---------- */
.mapel-list {
    margin-top: 10px;
}

.mapel-item {
    padding: 5px 0;
}

/* ---------- Stats ---------- */
.stats-card {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.stat-item {
    flex: 1;
    min-width: 120px;
    background-color: white;
    border-radius: var(--border-radius);
    padding: 10px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 24px;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    font-size: 12px;
    color: #777;
}

/* ---------- Tables ---------- */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th, table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

table th {
    background-color: #f1f1f1;
    font-weight: 500;
}

table tr:hover {
    background-color: #f9f9f9;
}

/* ---------- Chapter List ---------- */
.chapter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

.chapter-item {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background-color: #f1f1f1;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.chapter-item:hover:not(.completed) {
    background-color: #e0e0e0;
}

.chapter-item.completed {
    background-color: var(--success-color);
    color: var(--success-text);
}

/* ---------- Theme Options ---------- */
.theme-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.theme-option {
    width: 80px;
    padding: 10px;
    background-color: #f1f1f1;
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-option:hover {
    transform: translateY(-2px);
}

.theme-option.active {
    border: 2px solid var(--primary-color);
}

.color-preview {
    height: 20px;
    margin-bottom: 5px;
    border-radius: 3px;
}

/* Custom Theme Section */
.custom-theme-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.color-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.color-input-group {
    margin-bottom: 10px;
}

.color-input-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
}

.color-input-wrapper {
    display: flex;
    align-items: center;
}

.color-input-wrapper input[type="color"] {
    width: 40px;
    height: 30px;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
}

.color-input-wrapper input[type="text"] {
    flex: 1;
    border-left: none;
    border-radius: 0 4px 4px 0;
}

/* ---------- Toast Notifications ---------- */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1500;
}

.toast {
    display: flex;
    align-items: center;
    margin-top: 10px;
    padding: 10px 15px;
    background-color: var(--success-color);
    color: white;
    border-radius: 4px;
    box-shadow: var(--shadow-md);
    min-width: 250px;
    max-width: 350px;
    animation: slideInRight 0.3s, fadeOut 0.5s 2.5s forwards;
}

.toast-icon {
    margin-right: 10px;
    font-size: 16px;
}

.toast-body {
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 0 5px;
    opacity: 0.7;
}

.toast-close:hover {
    opacity: 1;
}

/* ---------- Loading Spinner ---------- */
.spinner {
    margin: 20px auto;
    width: 70px;
    text-align: center;
}

.spinner > div {
    width: 12px;
    height: 12px;
    background-color: var(--primary-color);
    border-radius: 100%;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out both;
}

.spinner .bounce1 {
    animation-delay: -0.32s;
}

.spinner .bounce2 {
    animation-delay: -0.16s;
}

.spinner-sm > div {
    width: 8px;
    height: 8px;
}

.spinner-lg > div {
    width: 16px;
    height: 16px;
}

.spinner-primary > div { background-color: var(--primary-color); }
.spinner-secondary > div { background-color: var(--secondary-color); }
.spinner-info > div { background-color: var(--info-color); }
.spinner-warning > div { background-color: var(--warning-color); }
.spinner-danger > div { background-color: var(--danger-color); }
.spinner-success > div { background-color: var(--success-color); }

.page-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideInRight {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* ---------- Responsive Adjustments ---------- */
@media (max-width: 768px) {
    .desktop-tabs {
        display: none;
    }
    
    .mobile-nav {
        display: block;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .card-actions {
        margin-top: 10px;
        width: 100%;
        justify-content: flex-end;
    }
    
    .container {
        padding: 5px;
    }
    
    header h1 {
        font-size: 1.3rem;
    }
    
    .stats-card {
        display: none;
    }
    
    .theme-options {
        grid-template-columns: repeat(2, 1fr);
    }
}