/* CSE Website Prototype Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0071e3;
    --primary-hover: #0077ed;
    --secondary-color: #1d1d1f;
    --text-color: #1d1d1f;
    --text-secondary: #86868b;
    --border-color: #d2d2d7;
    --bg-light: #f5f5f7;
    --bg-white: #ffffff;
    --success-color: #34c759;
    --warning-color: #ff9500;
    --error-color: #ff3b30;
    --info-color: #5e5ce6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-light);
    line-height: 1.6;
}

/* Header & Navigation */
.header {
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Hide mobile menu toggle by default (shown only on mobile) */
.mobile-menu-toggle {
    display: none;
}

/* Hide mobile menu close button by default (shown only on mobile) */
.mobile-menu-close {
    display: none !important;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
}

.nav-menu {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
}

.nav-menu a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.3s;
}

.nav-menu a:hover {
    color: var(--primary-color);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lang-switch {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.container-narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

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

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

.btn-secondary {
    background-color: var(--bg-light);
    color: var(--text-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

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

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

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

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

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

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

.table th {
    font-weight: 600;
    background-color: var(--bg-light);
}

.table tr:hover {
    background-color: var(--bg-light);
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
}

.badge-yellow {
    background-color: #fff3cd;
    color: #856404;
}

.badge-blue {
    background-color: #cfe2ff;
    color: #084298;
}

.badge-green {
    background-color: #d1e7dd;
    color: #0f5132;
}

.badge-red {
    background-color: #f8d7da;
    color: #842029;
}

.badge-gray {
    background-color: #e9ecef;
    color: #495057;
}

/* Article Cards */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.article-card {
    background: var(--bg-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.article-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: var(--bg-light);
}

.article-content {
    padding: 1.5rem;
}

.article-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.article-excerpt {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.article-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pinned-badge {
    background-color: var(--warning-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, #005bb5 100%);
}

.login-card {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.login-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-align: center;
}

.login-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

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

.file-upload:hover {
    border-color: var(--primary-color);
}

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

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-info {
    background-color: #cfe2ff;
    color: #084298;
    border: 1px solid #b6d4fe;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffecb5;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.alert-danger {
    background-color: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--bg-light);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.3s;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.tab {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

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

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

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Activity Registration */
.registration-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.registration-status.registered {
    background-color: #d1e7dd;
    border: 1px solid #badbcc;
}

.registration-status.waiting {
    background-color: #fff3cd;
    border: 1px solid #ffecb5;
}

/* Responsive Design - Mobile First Approach */

/* Small mobile devices (320px and up) */
@media (max-width: 480px) {
    .nav-container {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
    }

    .nav-menu {
        display: none; /* Hidden by default, shown when menu is open */
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        z-index: 9999;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        font-size: 1.2rem;
        list-style: none;
        margin: 0;
        padding: 2rem;
    }

    .nav-menu.mobile-open {
        display: flex !important;
    }

    .nav-menu li {
        width: 100%;
        text-align: center;
    }

    .nav-menu li a {
        padding: 1rem 2rem;
        display: block;
        text-align: center;
        border-radius: 12px;
        transition: all 0.2s;
        color: var(--text-color);
        text-decoration: none;
        font-weight: 500;
        border: 2px solid transparent;
    }

    .nav-menu li a:hover,
    .nav-menu li a:focus {
        background-color: var(--primary-color);
        color: white;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 113, 227, 0.3);
    }

    /* Mobile hamburger menu */
    .mobile-menu-toggle {
        display: flex;
        background: rgba(0, 0, 0, 0.1);
        border: 2px solid var(--border-color);
        padding: 0.75rem;
        cursor: pointer;
        z-index: 10000;
        position: relative;
        border-radius: 6px;
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
        align-items: center;
    }

    .mobile-menu-toggle:hover {
        background: rgba(0, 0, 0, 0.2);
    }

    .mobile-menu-toggle:active {
        background: rgba(0, 0, 0, 0.25);
    }

    .hamburger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        width: 20px;
        height: 14px;
        position: relative;
    }

    .hamburger span {
        display: block;
        height: 3px;
        width: 100%;
        background: var(--text-color);
        border-radius: 2px;
        opacity: 1;
        transform: rotate(0deg);
        transition: 0.25s ease-in-out;
        margin: 2px 0;
        position: relative;
    }

    /* Hamburger animation when open */
    .mobile-menu-toggle.open .hamburger span:nth-child(1) {
        transform: rotate(45deg) translate(3px, 3px);
    }

    .mobile-menu-toggle.open .hamburger span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.open .hamburger span:nth-child(3) {
        transform: rotate(-45deg) translate(3px, -3px);
    }

    /* Close button in menu */
    .mobile-menu-close {
        position: absolute;
        top: 2rem;
        right: 2rem;
        background: rgba(0, 0, 0, 0.1);
        border: none;
        font-size: 2rem;
        cursor: pointer;
        color: var(--text-color);
        padding: 0.5rem;
        z-index: 10001;
        border-radius: 50%;
        width: 44px;
        height: 44px;
        display: flex !important;
        align-items: center;
        justify-content: center;
        transition: all 0.2s;
    }

    .mobile-menu-close:hover {
        background: var(--error-color);
        color: white;
        transform: rotate(90deg);
    }

    .user-menu {
        flex-direction: column;
        align-items: flex-end;
        gap: 0.5rem;
    }

    .lang-switch {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }

    .container {
        padding: 1rem;
    }

    .container-narrow {
        padding: 1rem;
    }

    .card {
        margin-bottom: 1rem;
        padding: 1rem;
    }

    .card-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .card-title {
        font-size: 1.25rem;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

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

    .d-flex.keep-row {
        flex-direction: row;
    }

    /* Forms on mobile */
    .form-group {
        margin-bottom: 1rem;
    }

    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Tables on mobile - stack vertically */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        font-size: 0.85rem;
    }

    .table td, .table th {
        padding: 0.5rem 0.25rem;
        word-break: break-word;
    }

    /* Statistics grids */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
        text-align: center;
    }

    /* Hide less important columns on mobile */
    .mobile-hidden {
        display: none;
    }

    /* Stack action buttons vertically */
    .actions-mobile {
        flex-direction: column;
        gap: 0.5rem;
    }

    .actions-mobile .btn {
        width: 100%;
    }
}

/* Mobile tablets (481px to 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .nav-container {
        padding: 1rem 1.5rem;
    }

    .nav-menu {
        flex-direction: column;
        gap: 0.75rem;
    }

    .nav-menu li a {
        font-size: 0.9rem;
    }

    .container {
        padding: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .article-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .card-header {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1rem;
    }

    /* Tables - still responsive but more space */
    .table {
        font-size: 0.9rem;
    }

    /* Forms can be wider */
    .d-flex {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .d-flex > * {
        flex: 1;
        min-width: 200px;
    }
}

/* Larger tablets and small desktops (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .nav-menu {
        gap: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .article-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Original mobile styles (enhanced) */
@media (max-width: 768px) {
    /* Navigation improvements */
    .nav-menu {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem 0;
    }

    .nav-menu li a {
        display: block;
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--border-color);
    }

    .article-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Enhanced card layouts for mobile */
    .card {
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    /* Better spacing for mobile */
    .alert {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    /* Tabs mobile optimization */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        flex-shrink: 0;
        min-width: 120px;
        font-size: 0.9rem;
    }

    /* Progress bars */
    .progress-bar {
        height: 8px;
    }

    /* Input improvements for mobile */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px; /* Better touch targets */
    }

    /* Button improvements */
    .btn {
        min-height: 44px;
        font-size: 1rem;
    }

    .btn-small {
        min-height: 36px;
        font-size: 0.9rem;
    }
}

/* Touch-friendly improvements for all mobile devices */
@media (max-width: 1024px) and (pointer: coarse) {
    /* Larger touch targets */
    button, .btn, a[role="button"] {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1rem;
    }

    /* Better spacing for touch */
    .form-group {
        margin-bottom: 1.5rem;
    }

    /* Improved checkbox and radio targets */
    input[type="checkbox"],
    input[type="radio"] {
        transform: scale(1.2);
        margin-right: 0.75rem;
    }

    /* Better link spacing */
    a {
        padding: 0.25rem 0;
        margin: 0.125rem 0;
    }
}

/* Landscape phone optimization */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        position: static; /* Don't stick on landscape phones */
    }

    .nav-container {
        padding: 0.5rem 1rem;
    }

    .container {
        padding-top: 0.5rem;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-secondary);
}

/* Mobile-specific utilities */
.mobile-hidden {
    display: block;
}

.mobile-only {
    display: none;
}

.mobile-stack {
    display: flex;
}

.mobile-full-width {
    width: auto;
}

.keep-row {
    flex-direction: row !important;
}

.actions-mobile {
    display: flex;
}

/* Responsive table wrapper */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Mobile breakpoint utilities */
@media (max-width: 768px) {
    .mobile-hidden {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    .mobile-stack {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .mobile-full-width {
        width: 100% !important;
    }

    /* Mobile-friendly table alternatives */
    .table-mobile-cards .table {
        display: none;
    }

    .table-mobile-cards .mobile-card-view {
        display: block;
    }

    .mobile-card-view {
        display: none;
    }

    .mobile-card {
        background: white;
        border-radius: 8px;
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .mobile-card-title {
        font-weight: 600;
        margin-bottom: 0.5rem;
        color: var(--primary-color);
    }

    .mobile-card-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.25rem 0;
        border-bottom: 1px solid var(--border-color);
    }

    .mobile-card-row:last-child {
        border-bottom: none;
    }

    .mobile-card-label {
        font-weight: 500;
        color: var(--text-secondary);
        font-size: 0.85rem;
    }

    .mobile-card-value {
        text-align: right;
    }
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.flex-wrap {
    flex-wrap: wrap;
}

.flex-1 {
    flex: 1;
}
