/* Dark Theme - Mobile Optimized with Instagram Image and Gradient Text */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #1a1a1a;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    font-size: 16px;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Typography */
h1 {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 1rem;
    color: #4a9eff;
}

h2 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem 0;
    color: #ffffff;
    border-bottom: 2px solid #333;
    padding-bottom: 0.5rem;
}

/* Login Page Styles */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
}

.login-box {
    background-color: #2a2a2a;
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    border: 1px solid #333;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.logo-section {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-circle {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #4a9eff, #3a8eef);
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.logo-text {
    color: white;
    font-weight: bold;
}

.app-title {
    font-size: 2.2rem;
    font-weight: bold;
    background: linear-gradient(135deg, #4a9eff, #3a8eef);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.app-subtitle {
    color: #cccccc;
    font-size: 1rem;
    margin-bottom: 0;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: #cccccc;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #444;
    border-radius: 6px;
    background-color: #1a1a1a;
    color: #ffffff;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #4a9eff;
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

.btn {
    border: none;
    border-radius: 6px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-weight: 600;
}

.btn--primary {
    background: linear-gradient(135deg, #4a9eff, #3a8eef);
    color: #ffffff;
}

.btn--primary:hover {
    background: linear-gradient(135deg, #3a8eef, #2a7edf);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 158, 255, 0.3);
}

.btn--secondary {
    background: #f44336;
    color: white;
}

.btn--secondary:hover {
    background: #d32f2f;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(244, 67, 54, 0.3);
}

.btn--gradient {
    background: linear-gradient(135deg, #4a9eff, #3a8eef);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn--gradient:hover {
    background: linear-gradient(135deg, #3a8eef, #2a7edf);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 158, 255, 0.4);
}

.login-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: bold;
}

/* Instagram Icon and Gradient Text Styles */
.instagram-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    vertical-align: middle;
    border-radius: 4px;
    transition: transform 0.3s ease, filter 0.3s ease;
    object-fit: cover;
}

.instagram-fallback {
    margin-right: 8px;
    vertical-align: middle;
    font-size: 18px;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.5rem;
}

.social-link:hover .instagram-icon {
    transform: scale(1.1) rotate(5deg);
    filter: brightness(1.1);
}

.instagram-handle {
    background: linear-gradient(45deg, #f9ce34, #ee2a7b, #6228d7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: #f9ce34;
    /* Fallback color for browsers that don't support gradients */
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
}

.instagram-handle:hover {
    transform: translateY(-1px);
    text-shadow: 0 2px 8px rgba(249, 206, 52, 0.3);
}

/* Ensure gradient works across browsers */
@supports not (-webkit-background-clip: text) {
    .instagram-handle {
        color: #f9ce34;
    }
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #333;
    color: #888;
    font-size: 0.9rem;
}

/* Dashboard Styles */
.dashboard-header {
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-left h1 {
    text-align: left;
    margin-bottom: 0.5rem;
}

.welcome-text {
    color: #cccccc;
    margin: 0;
}

.header-right {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.share-btn {
    font-size: 0.9rem;
    padding: 0.6rem 1.2rem;
}

.logout-btn {
    font-size: 0.9rem;
    padding: 0.6rem 1.2rem;
}

/* CGPA Section - Updated for single card */
.cgpa-section {
    margin-bottom: 2rem;
}

.cgpa-card-container {
    display: flex;
    justify-content: center;
}

.stat-card {
    background-color: #2a2a2a;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #333;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.cgpa-card {
    min-width: 200px;
    border-left: 4px solid #4a9eff;
}

.stat-number {
    font-size: 3rem;
    font-weight: bold;
    color: #4a9eff;
    display: block;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(74, 158, 255, 0.3);
}

.stat-label {
    color: #cccccc;
    font-size: 1.1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Subject Cards */
.subjects-grid {
    display: grid;
    gap: 1.5rem;
}

.subject-card {
    background-color: #2a2a2a;
    border-radius: 12px;
    padding: 1.5rem;
    border-left: 4px solid #333;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.subject-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.subject-card.success {
    border-left-color: #4caf50;
}

.subject-card.warning {
    border-left-color: #ff9800;
}

.subject-card.danger {
    border-left-color: #f44336;
}

.subject-title {
    font-weight: bold;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #ffffff;
    line-height: 1.4;
}

.course-code {
    color: #ff9800;
    font-style: italic;
    font-weight: 500;
    background-color: rgba(255, 152, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 1rem;
}

.subject-main-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1rem 0;
    gap: 1rem;
}

.attendance-percentage {
    flex: 1;
}

.percentage-number {
    font-size: 1.8rem;
    font-weight: bold;
    display: block;
    margin-bottom: 0.25rem;
}

.percentage-number.success {
    color: #4caf50;
}

.percentage-number.warning {
    color: #ff9800;
}

.percentage-number.danger {
    color: #f44336;
}

.attendance-details {
    color: #ccc;
    font-size: 0.9rem;
}

.status-display {
    text-align: center;
    flex: 1;
}

.status-number {
    font-size: 2.5rem;
    font-weight: 900;
    display: block;
    margin-bottom: 0.25rem;
}

.status-number.status-can-miss {
    color: #4caf50;
}

.status-number.status-must-attend {
    color: #f44336;
    animation: pulse-critical 2s infinite;
}

.status-label {
    font-size: 1rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-label.status-can-miss {
    color: #4caf50;
}

.status-label.status-must-attend {
    color: #f44336;
}

@keyframes pulse-critical {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.subject-footer {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #333;
    font-size: 0.85rem;
    color: #aaa;
}

.subject-footer>div {
    margin-bottom: 0.25rem;
}

.dashboard-footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 1px solid #333;
    color: #888;
    font-size: 0.9rem;
}

/* Error Message */
.error-message {
    background-color: rgba(244, 67, 54, 0.2);
    border: 1px solid #f44336;
    color: #f44336;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .header-content {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .header-left h1 {
        text-align: center;
    }

    .header-right {
        justify-content: center;
    }

    .subject-main-info {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .status-number {
        font-size: 2.2rem;
    }

    .subject-title {
        font-size: 1.2rem;
    }

    .login-box {
        margin: 1rem;
        padding: 1.5rem;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    .cgpa-card {
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .stat-card,
    .subject-card {
        padding: 1rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .percentage-number {
        font-size: 1.5rem;
    }

    .status-number {
        font-size: 1.8rem;
    }

    .subject-title {
        font-size: 1.1rem;
    }

    .app-title {
        font-size: 1.8rem;
    }

    .header-right {
        flex-direction: column;
        gap: 0.5rem;
    }

    .share-btn,
    .logout-btn {
        width: 100%;
        text-align: center;
    }

    .instagram-icon {
        width: 18px;
        height: 18px;
    }
}

/* Download Button Styles */
.download-btn {
    margin-bottom: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 200px;
    text-decoration: none;
    gap: 10px;
}

.btn-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

.btn-icon-small {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

/* Dashboard Header Buttons */
.header-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}

.download-btn-dashboard {
    font-size: 0.9rem;
    padding: 0.6rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #4a9eff, #3a8eef);
    color: white;
    border: none;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.download-btn-dashboard:hover {
    background: linear-gradient(135deg, #3a8eef, #2a7edf);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 158, 255, 0.4);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

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

.modal-content {
    background-color: #2a2a2a;
    padding: 2rem;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    position: relative;
    border: 1px solid #444;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.close-modal:hover {
    color: #fff;
}

.modal-icon-container {
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
}

.modal-app-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    color: #fff;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    border: none;
    padding: 0;
}

.modal-content p {
    color: #ccc;
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

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

@media (max-width: 480px) {
    .modal-content {
        padding: 1.5rem;
    }

    .modal-actions {
        flex-direction: column;
    }

    .header-buttons {
        align-items: stretch;
        width: 100%;
    }

    .download-btn-dashboard {
        justify-content: center;
    }
}

/* Status GIF Styles */
.status-gif {
    width: 60px;
    height: auto;
    display: block;
    margin: 0 auto 0.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

@media (max-width: 480px) {
    .status-gif {
        width: 50px;
    }
}

/* Attendance Header with Toggle */
.attendance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.attendance-header h2 {
    margin: 0;
    border-bottom: none;
    padding-bottom: 0;
}

/* Percentage Toggle */
.percentage-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toggle-label {
    color: #aaa;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toggle-switch {
    display: flex;
    background: #222;
    border-radius: 8px;
    border: 1px solid #444;
    overflow: hidden;
}

.toggle-btn {
    padding: 0.5rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 700;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}

.toggle-btn.active {
    background: linear-gradient(135deg, #4a9eff, #3a8eef);
    color: #fff;
    box-shadow: 0 2px 10px rgba(74, 158, 255, 0.4);
}

.toggle-btn:not(.active):hover {
    color: #ccc;
    background: #333;
}

@media (max-width: 480px) {
    .attendance-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .percentage-toggle {
        justify-content: center;
    }

    .toggle-btn {
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
    }
}

/* ===== Timetable Section ===== */
.timetable-section {
    margin-top: 2.5rem;
    margin-bottom: 2rem;
}

.timetable-wrapper {
    background-color: #2a2a2a;
    border-radius: 12px;
    border: 1px solid #333;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    margin-top: 1rem;
}

.timetable-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.timetable-scroll::-webkit-scrollbar {
    height: 8px;
}

.timetable-scroll::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.timetable-scroll::-webkit-scrollbar-thumb {
    background: #4a9eff;
    border-radius: 4px;
}

.timetable-scroll::-webkit-scrollbar-thumb:hover {
    background: #3a8eef;
}

.timetable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 600px;
    font-size: 0.9rem;
}

.timetable thead th {
    background: linear-gradient(135deg, #4a9eff, #3a8eef);
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.85rem 1rem;
    text-align: center;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
    font-size: 0.8rem;
}

.timetable thead th:first-child {
    border-radius: 0;
    text-align: left;
    padding-left: 1.25rem;
}

.timetable tbody tr {
    transition: background-color 0.2s ease;
}

.timetable tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

.timetable tbody tr:hover {
    background-color: rgba(74, 158, 255, 0.08);
}

.timetable tbody td {
    padding: 0.75rem 0.85rem;
    text-align: center;
    border-bottom: 1px solid #333;
    color: #ddd;
    font-size: 0.85rem;
    vertical-align: middle;
    white-space: nowrap;
}

.timetable tbody td.day-cell {
    font-weight: 700;
    color: #4a9eff;
    text-align: left;
    padding-left: 1.25rem;
    background-color: rgba(74, 158, 255, 0.06);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    min-width: 80px;
}

.timetable tbody td.has-class {
    color: #fff;
    font-weight: 500;
    background-color: rgba(74, 158, 255, 0.04);
}

.timetable tbody td.empty-cell {
    color: #555;
}

/* Attendance-based timetable cell colors */
.timetable tbody td.tt-success {
    background-color: rgba(76, 175, 80, 0.18);
    color: #81c784;
    font-weight: 600;
    border-left: 2px solid rgba(76, 175, 80, 0.4);
}

.timetable tbody td.tt-warning {
    background-color: rgba(255, 152, 0, 0.18);
    color: #ffb74d;
    font-weight: 600;
    border-left: 2px solid rgba(255, 152, 0, 0.4);
}

.timetable tbody td.tt-danger {
    background-color: rgba(244, 67, 54, 0.18);
    color: #e57373;
    font-weight: 600;
    border-left: 2px solid rgba(244, 67, 54, 0.4);
}

.timetable tbody tr:last-child td {
    border-bottom: none;
}

/* No timetable fallback */
.no-timetable {
    background-color: #2a2a2a;
    border: 1px dashed #444;
    border-radius: 12px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: #888;
    font-size: 1rem;
    margin-top: 1rem;
}

.no-timetable p {
    margin: 0;
}

/* Timetable mobile responsive */
@media (max-width: 768px) {
    .timetable {
        font-size: 0.8rem;
        min-width: 500px;
    }

    .timetable thead th {
        padding: 0.7rem 0.6rem;
        font-size: 0.75rem;
    }

    .timetable tbody td {
        padding: 0.6rem 0.5rem;
        font-size: 0.78rem;
    }
}

@media (max-width: 480px) {
    .timetable {
        font-size: 0.75rem;
        min-width: 450px;
    }

    .timetable thead th {
        padding: 0.6rem 0.4rem;
        font-size: 0.7rem;
    }

    .timetable tbody td {
        padding: 0.5rem 0.4rem;
        font-size: 0.72rem;
    }

    .timetable-section {
        margin-top: 1.5rem;
    }
}
