/* ========================================
   GLOBAL STYLES
   ======================================== */
html {
    overflow-y: scroll;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, .tablebottom {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(150deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}
.center {
    text-align: center;
}

input[type="radio"] {
    accent-color: #667eea;
}
#logo {
    display: block;
    width: 80px;
}
#org {
    display: none;
}
/* ========================================
   CONTAINER & LAYOUT
   ======================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.container-narrow {
    max-width: 600px;
    margin: 50px auto;
}

.container-medium {
    max-width: 1000px;
    margin: 0 auto;
}

.content {
    display: flow-root;
}
/* ========================================
   HEADER
   ======================================== */

.header {
    background: white;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #667eea;
    font-size: 28px;
    margin-bottom: 10px;
    text-align: center;
}

.header p {
    color: #666;
}

.header.danger h1 {
    color: #dc3545;
    fill: #dc3545;
}

/* ========================================
   USER INFO
   ======================================== */

.moduleinfo {
    color: #667eea;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 5px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-details {
    font-weight: 600;
    text-align: center;
}

.user-email {
    font-size: 12px;
    color: #666;
    text-align: center;
}

.user-id {
    font-size: 12px;
    color: #667eea;
    text-align: center;
}
.user-action {
    display: flex;
    flex-flow: wrap;
    gap: 5px;
    justify-content: center;
}

/* ========================================
   CONTENT & CARDS
   ======================================== */

.content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.event-card {
    border: 1px solid #e0e0e0;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.event-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.event-title {
    font-size: 20px;
    color: #333;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
}

.event-details {
    color: #666;
    font-size: 14px;
}
.event-details table {
    margin-top: 0;
}
.reject-reason {
    border-top: solid #ffc107;
    background: #fff3cd;
    color: #856404;
}

a.pin {
    display: block;
    height: 20px;
    fill: lightgrey;
    min-width: 20px;
}
a.pin svg {
    width: 100%;
    height: 100%;
}
a.pinned {
    fill: #667eea;
}
/* ========================================
   INFO BOXES
   ======================================== */

.info-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.info-box h3 {
    color: #333;
    margin-bottom: 15px;
}

.info-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    width: 49%;
    float: left;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: #666;
}

.info-value {
    color: #333;
}

/* ========================================
   STATISTICS
   ======================================== */

.stats-box {
    background: #ffebee;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.stats-number {
    font-size: 48px;
    font-weight: bold;
    color: #dc3545;
}

.stats-label {
    color: #666;
    margin-top: 5px;
    font-size: 14px;
}

.class-stats {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 30px;
}

.stat-item {
    flex: 1;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    color: #666;
    margin-top: 5px;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    font-family: inherit;
    padding: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    white-space: nowrap;
}
.btn[disabled] {
    background: gray!important;
    cursor: not-allowed!important;
}
.btn-primary {
    background: #667eea;
    color: white;
    fill: white;
}

.btn-primary.btn-eop {
    background: #764ba2;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    fill: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
    fill: white;
    position: relative;
    transition: all 0.3s ease;
}

.btn-success:hover {
    background: #218838;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
    fill: #212529;
    position: relative;
    transition: all 0.3s ease;
}

.btn-warning:hover {
    background: #e0a800;
}

/* Lock button with hover text */
.lock-btn {
    position: relative;
    overflow: visible;
}

.lock-btn::after {
    content: attr(data-hover-text);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: #333;
    color: white;
    fill: white;
    padding: 8px 12px;
    border-radius: 5px;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
}

.lock-btn::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    border: 6px solid transparent;
    border-top-color: #333;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
}

.lock-btn:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

.lock-btn:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.lock-toggle-btn:hover::before {
    content: attr(data-action);
}

.lock-toggle-btn::before {
    font-size: 14px; /* Show hover text */
}

.lock-toggle-btn {
    position: relative;
    transition: all 0.3s ease;
}

.lock-toggle-btn .lock-state {
    display: inline-block;
    transition: all 0.3s ease;
}

.lock-toggle-btn:hover .lock-state {
    transform: translateY(-100%);
    opacity: 0;
}

.lock-toggle-btn .lock-action {
    position: absolute;
    display: none;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.lock-toggle-btn:hover .lock-action {
    top: 50%;
    transform: translate(-50%, -50%);
    display: inline-block;
}

/* Locked state (orange) */
.lock-toggle-btn.btn-warning:hover {
    background: #28a745 !important; /* Changes to green on hover */
    color: white;
    fill: white;
}

/* Unlocked state (green) */
.lock-toggle-btn.btn-success:hover {
    background: #ffc107 !important; /* Changes to orange on hover */
    color: #212529;
    fill: #212529;
}

.event-locked {
    opacity: 0.6;
    position: relative;
}

.btn-danger {
    background: #dc3545;
    color: white;
    fill: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-google {
    background: white;
    color: #444;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-google:hover {
    background: #f8f9fa;
}

.btn-large {
    padding: 12px 30px;
    font-size: 16px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* ========================================
   FORMS
   ======================================== */
#createEventForm {
    height: 0px;
    overflow: hidden;
    transition: height 0.3s ease;
    border: 1px solid #e0e0e0;
    padding: 0px;
    border-radius: 8px;
}
.required {
    color: #bf0000;
    user-select: none;
    font-size: 14px;
    vertical-align: top;
}
.datetime {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
}
.form-group input,
.form-group textarea,
.form-group select,
#search1, #search2,
#search-full input,
#search-mobile input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    tab-size: 4;
}

input#edit_pin, input#create_pin {
    width: auto;
    display: inline-block;
}
label[for="edit_pin"], label[for="create_pin"] {
    display: inline-block;
}
.form-group small {
    color: #666;
    font-size: 12px;
    display: block;
    margin-top: 5px;
}

.form-group input[type="file"] {
    border: 2px dashed #ddd;
    cursor: pointer;
}
.time-input {
    transition: border-color 0.3s ease;
}

.time-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.time-error {
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}


#search1, #search2, #search-full, #search-mobile {
    font-variant-emoji: text;
    margin: 10px 0;
}
#search-full {
    display: block;
    width: 85%;
    margin: auto;
    position: relative;
}
#search-btn-full, #search-btn-mobile {
    position: absolute;
    padding: 12px;
    font-size: 14px;
    right: 0px;
    cursor: pointer;
}
#search-mobile {
    display: none;
}

/* ========================================
   TABS
   ======================================== */

.tabs {
    display: flex;
    gap: 0px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
}

.tab {
    padding: 10px 0px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 16px;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    flex: 1;
}

.tab.active {
    color: #667eea;
    fill: #667eea;
    border-bottom-color: #667eea;
}

.tab:hover {
    color: #5568d3;
    fill: #5568d3;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========================================
   TABLES
   ======================================== */

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

tr {
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}
.event-card .first-col {
    font-weight: bold;
    width: 20%;
}
th {
    font-weight: 600;
    color: #333;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}
/* ========================================
   POINTS & BADGES
   ======================================== */

.points-earned {
    color: #28a745;
    font-weight: 600;
}

.points-unchanged {
    font-weight: 600;
}

.points-deducted {
    color: #dc3545;
    font-weight: 600;
}

.total-points {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    margin-top: 20px;
    text-align: right;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-approved {
    background: #d4edda;
    color: #155724;
}

.status-rejected {
    background: #f8d7da;
    color: #721c24;
}

.class-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #667eea;
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.student-badge {
    display: inline-block;
    color: #dc3545;
    border-radius: 12px;
    font-weight: 600;
}

.deduct-form {
    float: right;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    width: 49%;
}

.removeDeduct {
    display: inline-block;
}

/* ========================================
   ALERTS & MESSAGES
   ======================================== */

.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success,
.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    color: #856404;
}

.no-class-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    color: #856404;
}

/* ========================================
   LOGIN
   ======================================== */

.login-container {
    max-width: 400px;
    margin: 100px auto;
    background: white;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.login-container h2 {
    color: #667eea;
    margin-bottom: 30px;
}
.login-container #logo {
    margin: auto;
}

/* ========================================
   IMAGES & MEDIA
   ======================================== */

.file-preview {
    max-width: 500px;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 5px;
    margin-top: 10px;
    cursor: pointer;
}

.file-info {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* ========================================
   SPINNER & LOADER
   ======================================== */

.loader {
    text-align: center;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ========================================
   UTILITIES
   ======================================== */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: #666;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-15 {
    margin-bottom: 15px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mb-30 {
    margin-bottom: 30px;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mt-30 {
    margin-top: 30px;
}

.p-20 {
    padding: 20px;
}

.p-40 {
    padding: 40px;
}

/* ========================================
   SVG
   ======================================== */
svg {
    height: 1em;
    position: relative;
    top: 1.5px;
}

.tab svg {
    fill: inherit;
    display: block;
    margin: 5px auto 0 auto;
    height: 20px;
}
.file-info svg {
    height: 1.5em;
    position: relative;
    top: .15em;
}
/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .header {
        flex-direction: column;
    }

    .user-info {
        flex-direction: column;
        width: 100%;
    }

    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    .tab {
        padding: 10px 0;
        font-size: 12px;
    }

    .class-stats {
        gap: 15px;
    }

    table {
        font-size: 12px;
    }

    th,
    td {
        padding: 8px!important;
    }

    input[type="text"] {
        width: 100%;
        margin-bottom: 5px;
    }
    .form-group input,
    .form-group textarea,
    .form-group select,
    #search1, #search2,
    #search-full input,
    #search-mobile input,
    #search-btn-mobile {
        font-size: 16px;
        padding: 5px;
    }

    .checkins-table th, .checkins-table td {
        padding: 4px;
    }
    .nomobile {
        display: none;
    }
    .datetime {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0px;
    }
    .checkins-table th {
        text-align: center;
    }
    .info-card, .deduct-form {
        width: 100%;
    }
    body {
        padding: 10px;
    }
    .content {
        padding: 15px;
    }
    #logo {
        display: none;
    }
    #org {
        display: block;
    }

    #search-full {
        display: none;
    }
    #search-mobile {
        display: block;
        width: 100%;
        margin-top: 15px;
        position: relative;
    }
    .btn {
        margin-right: 0;
    }
    .removeDeduct .btn.btn-danger {
        font-size: 1em;
        padding: 2px 5px;
    }
    .tab {
        flex: unset;
    }
}
