/* Global Styles for Lecture Q&A System - Mobile Optimized */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
}

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

.container-small {
    max-width: 600px;
    margin: 0 auto;
}

.container-medium {
    max-width: 800px;
    margin: 0 auto;
}

/* Card Styles */
.card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 15px;
}

.card-compact {
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

/* Typography */
h1, h2, h3 {
    color: #333;
    margin-bottom: 15px;
}

h1 {
    font-size: 24px;
    text-align: center;
}

h2 {
    font-size: 20px;
}

h3 {
    font-size: 18px;
}

p {
    color: #666;
    margin-bottom: 12px;
    font-size: 15px;
    line-height: 1.5;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
    font-size: 13px;
}

/* Emoji and Icons */
.emoji {
    font-size: 48px;
    margin-bottom: 15px;
    text-align: center;
}

/* Forms */
.form-group {
    margin-bottom: 18px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
    font-size: 15px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 14px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    transition: border 0.3s;
    -webkit-appearance: none;
    appearance: none;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
}

.code-input {
    text-align: center;
    text-transform: uppercase;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 2px;
}

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

/* Buttons */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    text-align: center;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: #ffc107;
    color: #000;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-block {
    width: 100%;
    display: block;
}

/* Button Groups */
.button-group {
    display: flex;
    gap: 12px;
    flex-direction: column;
}

.nav-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.nav-buttons .btn {
    width: 100%;
}

/* Links */
.back-link {
    color: #667eea;
    text-decoration: none;
    margin-bottom: 15px;
    display: inline-block;
    font-weight: 600;
    font-size: 15px;
    padding: 8px 0;
}

.back-link:hover {
    text-decoration: underline;
}

/* Messages */
.error {
    color: #dc3545;
    text-align: center;
    margin-bottom: 15px;
    background: #ffebee;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #dc3545;
    font-size: 14px;
}

.success {
    color: #28a745;
    text-align: center;
    margin-bottom: 15px;
    background: #d4edda;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #28a745;
    font-size: 14px;
}

/* Session Display */
.session-code {
    font-size: 28px;
    font-weight: bold;
    color: #667eea;
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    margin: 15px 0;
    word-break: break-all;
}

/* Session Items */
.session-item {
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Question Items */
.question {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin: 10px 0;
}

.question.answered {
    background: #d4edda;
    border-color: #c3e6cb;
}

/* MCQ Items */
.mcq-item {
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    margin: 15px 0;
    position: relative;
    padding-top: 50px;
}

.mcq-item.active {
    border-color: #28a745;
    background: #f0fff4;
}

.mcq-item.expired {
    border-color: #dc3545;
    background: #fff5f5;
}

.mcq-item.answered {
    background: #f8f9fa;
    border-color: #28a745;
}

/* Options */
.option {
    padding: 12px;
    margin: 8px 0;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.5;
    word-break: break-word;
}

.option.correct {
    background: #d4edda;
    font-weight: bold;
}

.option-label {
    display: block;
    padding: 14px;
    margin: 10px 0;
    background: #f8f9fa;
    border: 2px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 15px;
    line-height: 1.5;
    word-break: break-word;
    -webkit-tap-highlight-color: transparent;
}

.option-label:hover,
.option-label:active {
    background: #e9ecef;
    border-color: #667eea;
}

input[type="radio"] {
    margin-right: 10px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Badges */
.type-badge {
    background: #667eea;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 11px;
    margin-left: 8px;
    display: inline-block;
}

.marks-badge {
    background: #667eea;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 13px;
}

.answered-badge {
    background: #28a745;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 13px;
}

.timer-badge {
    background: #dc3545;
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    margin-left: 8px;
}

/* Status Badges */
.status-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 12px;
}

.status-not-started {
    background: #e3f2fd;
    color: #1976d2;
}

.status-active {
    background: #d4edda;
    color: #28a745;
}

.status-expired {
    background: #ffebee;
    color: #dc3545;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 15px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 18px;
    border-radius: 10px;
    text-align: center;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
}

/* User Info */
.user-info {
    background: #e3f2fd;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-name {
    font-size: 16px;
    font-weight: bold;
    color: #1976d2;
}

/* Leaderboard */
.leaderboard-item {
    padding: 15px;
    margin: 12px 0;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.3s;
}

.leaderboard-item:hover {
    transform: scale(1.02);
}

.rank-1 {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: white;
    font-size: 18px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

.rank-2 {
    background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
    color: white;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(192, 192, 192, 0.4);
}

.rank-3 {
    background: linear-gradient(135deg, #CD7F32 0%, #B8860B 100%);
    color: white;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(205, 127, 50, 0.4);
}

.rank-other {
    background: #f8f9fa;
    border: 1px solid #ddd;
}

.rank-badge {
    font-size: 32px;
    text-align: center;
}

.student-info {
    flex: 1;
}

.student-name {
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 5px;
}

.student-stats {
    margin-top: 5px;
    font-size: 13px;
    opacity: 0.9;
}

.marks-display {
    font-size: 28px;
    font-weight: bold;
    text-align: center;
}

/* Trophy */
.trophy {
    font-size: 56px;
    text-align: center;
    margin: 15px 0;
}

/* Students List */
.students-list {
    max-height: 300px;
    overflow-y: auto;
}

.student-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

/* Two Column Layout */
.two-column {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

/* Upvote Button */
.upvote-btn {
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    text-decoration: none;
    font-weight: 600;
    width: 100%;
    text-align: center;
    display: inline-block;
}

.upvote-btn:hover {
    background: #667eea;
    color: white;
}

.upvotes {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
}

/* Timer Display */
.timer-display {
    font-size: 20px;
    font-weight: bold;
    color: #dc3545;
    margin: 10px 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 30px 15px;
    color: #999;
}

.empty-state h2 {
    color: #999;
    font-size: 18px;
}

.waiting-message {
    text-align: center;
    padding: 30px 15px;
    color: #666;
}

.waiting-message h2 {
    margin-bottom: 15px;
    font-size: 18px;
}

/* Required Field */
.required {
    color: #dc3545;
}

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

.mt-10 {
    margin-top: 10px;
}

.mt-15 {
    margin-top: 15px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-15 {
    margin-bottom: 15px;
}

.mb-20 {
    margin-bottom: 20px;
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

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

.gap-10 {
    gap: 10px;
}

.gap-15 {
    gap: 15px;
}

/* Tablet Styles (481px - 768px) */
@media (min-width: 481px) {
    body {
        padding: 15px;
    }
    
    .card {
        padding: 25px;
    }
    
    h1 {
        font-size: 28px;
    }
    
    .emoji {
        font-size: 56px;
    }
    
    .session-code {
        font-size: 32px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .nav-buttons .btn {
        width: auto;
    }
}

/* Desktop Styles (769px and up) */
@media (min-width: 769px) {
    body {
        padding: 20px;
    }
    
    .card {
        padding: 40px;
        border-radius: 20px;
    }
    
    .card-compact {
        padding: 30px;
        border-radius: 15px;
    }
    
    h1 {
        font-size: 32px;
    }
    
    h2 {
        font-size: 24px;
    }
    
    p {
        font-size: 16px;
    }
    
    .emoji {
        font-size: 64px;
    }
    
    .session-code {
        font-size: 36px;
    }
    
    .btn {
        width: auto;
        padding: 15px 30px;
        font-size: 18px;
    }
    
    .session-item {
        flex-direction: row;
        align-items: center;
    }
    
    .mcq-item {
        padding: 20px;
        padding-top: 20px;
    }
    
    .status-badge {
        top: 20px;
        right: 20px;
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .two-column {
        grid-template-columns: 2fr 1fr;
    }
    
    .leaderboard-item {
        flex-direction: row;
        align-items: center;
    }
    
    .rank-badge {
        font-size: 36px;
        margin-right: 15px;
        text-align: left;
    }
    
    .marks-display {
        font-size: 32px;
        text-align: right;
    }
    
    .user-info {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .user-name {
        font-size: 18px;
    }
    
    .timer-display {
        font-size: 24px;
    }
    
    input[type="radio"] {
        width: auto;
        height: auto;
    }
}

/* Touch-friendly improvements for all mobile devices */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch target sizes */
    .btn {
        min-height: 48px;
        padding: 16px 24px;
    }
    
    .option-label {
        min-height: 48px;
        padding: 16px;
    }
    
    .back-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    /* Prevent double-tap zoom */
    * {
        touch-action: manipulation;
    }
    
    /* Better active states for touch */
    .btn:active {
        transform: scale(0.98);
    }
    
    .option-label:active {
        background: #667eea;
        color: white;
        border-color: #667eea;
    }
}

/* Landscape mobile optimization */
@media (max-height: 500px) and (orientation: landscape) {
    .card {
        padding: 15px;
    }
    
    h1 {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .emoji {
        font-size: 32px;
        margin-bottom: 10px;
    }
    
    .session-code {
        font-size: 20px;
        padding: 12px;
    }
}