/* ===== Modern Reset & Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
    padding: 0;
    margin: 0;
}

/* ===== Header Section ===== */
.header-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
}

.header-content {
    text-align: center;
}

.logo-section {
    color: white;
}

.logo-section i {
    font-size: 60px;
    margin-bottom: 15px;
    animation: float 3s ease-in-out infinite;
}

.logo-section h1 {
    font-size: 42px;
    font-weight: 700;
    margin: 0 0 10px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 18px;
    font-weight: 300;
    opacity: 0.95;
    margin: 0;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* ===== Main Container ===== */
.main-container {
    max-width: 1200px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

.modern-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Controls Section ===== */
.controls-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 30px;
    border-bottom: 3px solid #667eea;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-group label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: block;
    font-size: 14px;
}

.control-group label i {
    margin-right: 8px;
    color: #667eea;
}

.camera-controls {
    margin-bottom: 20px;
}

.modern-select {
    width: 100%;
    padding: 14px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: white;
    height: 48px;
    line-height: 1.5;
}

.modern-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

/* ===== Button Styles ===== */
.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.modern-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modern-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.modern-btn:active {
    transform: translateY(0);
}

.modern-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

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

.btn-pause {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-stop {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

.btn-capture {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-submit {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    border-radius: 0 12px 12px 0 !important;
}

.btn-submit:hover {
    background: linear-gradient(135deg, #1a252f 0%, #2c3e50 100%);
}

.btn-view-attendance {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
    justify-content: center;
    font-size: 16px;
}

.btn-close {
    background: linear-gradient(135deg, #868f96 0%, #596164 100%);
    color: white;
}

/* ===== Input Styles ===== */
.manual-input-section {
    margin-bottom: 20px;
}

.manual-input-section-scanner {
    margin-top: 20px;
}

.manual-input-section-scanner label {
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    display: block;
    font-size: 14px;
}

.manual-input-section-scanner label i {
    margin-right: 8px;
    color: #667eea;
}

.input-group-modern {
    display: flex;
    gap: 0;
}

.input-group-modern-scanner {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
}

.input-group-modern-scanner .modern-input {
    flex: 1;
    min-width: 200px;
}

.input-group-modern-scanner .btn-submit {
    flex-shrink: 0;
}

.modern-input {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    flex: 1;
    height: 48px;
}

.input-group-modern .modern-input {
    border-radius: 12px 0 0 12px;
    border-right: none;
}

.modern-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.modern-input::placeholder {
    color: #aaa;
}

/* ===== Scanner & Result Section ===== */
.scanner-result-section {
    padding: 30px;
}

.scanner-card,
.result-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    height: 100%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: #667eea;
}

.scanner-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #1a1a1a;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    margin-bottom: 15px;
    min-height: 240px;
}

#webcodecam-canvas {
    max-width: 100%;
    width: 320px;
    height: 240px;
    display: block;
    background-color: #1a1a1a;
    margin: 0 auto;
}

.scanner-status {
    text-align: center;
    padding: 12px;
    background: #667eea;
    color: white;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.result-image-wrapper {
    background: #1a1a1a;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#scanned-img {
    max-width: 100%;
    width: 320px;
    height: 240px;
    display: block;
    margin: 0 auto;
    object-fit: contain;
    background: #f0f0f0;
    border-radius: 8px;
}

.result-content {
    text-align: center;
}

.result-box {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#scanned-QR,
#scanned-QR2 {
    word-break: break-word;
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #555;
}

/* ===== Scanner Laser Animation ===== */
.scanner-laser {
    position: absolute;
    margin: 20px;
    height: 40px;
    width: 40px;
    opacity: 0.8;
    z-index: 10;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.4; }
}

.laser-leftTop {
    top: 0;
    left: 0;
    border-top: solid #667eea 5px;
    border-left: solid #667eea 5px;
    border-radius: 8px 0 0 0;
}

.laser-leftBottom {
    bottom: 0;
    left: 0;
    border-bottom: solid #667eea 5px;
    border-left: solid #667eea 5px;
    border-radius: 0 0 0 8px;
}

.laser-rightTop {
    top: 0;
    right: 0;
    border-top: solid #667eea 5px;
    border-right: solid #667eea 5px;
    border-radius: 0 8px 0 0;
}

.laser-rightBottom {
    bottom: 0;
    right: 0;
    border-bottom: solid #667eea 5px;
    border-right: solid #667eea 5px;
    border-radius: 0 0 8px 0;
}

/* ===== Modal Styles ===== */
.modern-modal .modal-content {
    border: none;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.modern-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 30px;
    border: none;
}

.modern-modal-header .modal-title {
    font-weight: 600;
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modern-modal-header .close {
    color: white;
    opacity: 1;
    text-shadow: none;
    font-size: 32px;
    font-weight: 300;
}

.modern-modal-body {
    padding: 30px;
}

.scan-result-content,
.attendance-list {
    font-size: 15px;
    line-height: 1.8;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.attendance-list table {
    min-width: 600px;
    width: 100%;
}

.attendance-list .table-bordered {
    margin-bottom: 0;
}

.attendance-list .table-bordered th,
.attendance-list .table-bordered td {
    white-space: nowrap;
    font-size: 14px;
}

.attendance-list .table-bordered th {
    position: sticky;
    top: 0;
    z-index: 10;
}

.modern-modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #e0e0e0;
}

/* DataTables Responsive */
.dataTables_wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    font-size: 14px;
}

@media (max-width: 768px) {
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: center;
        margin-bottom: 10px;
    }
    
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        text-align: center;
        margin-top: 10px;
    }
    
    .dataTables_wrapper select,
    .dataTables_wrapper input {
        font-size: 13px;
    }
}

/* ===== Footer ===== */
.modern-footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px 0;
    text-align: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    margin-top: 40px;
}

.modern-footer p {
    margin: 0;
    color: #666;
    font-size: 14px;
    font-weight: 400;
}

/* ===== Table Styles ===== */
.table-bordered {
    color: #555;
    cursor: default;
}

.table-bordered th,
.table-bordered td {
    vertical-align: middle !important;
    padding: 12px;
}

.table-bordered th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

.table-bordered a:hover {
    text-decoration: none;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .header-gradient {
        padding: 30px 0;
    }
    
    .logo-section i {
        font-size: 45px;
    }
    
    .logo-section h1 {
        font-size: 32px;
    }
    
    .subtitle {
        font-size: 16px;
    }
    
    .controls-section {
        padding: 20px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .modern-btn {
        width: 100%;
        justify-content: center;
    }
    
    .scanner-result-section {
        padding: 20px;
    }
    
    .scanner-card,
    .result-card {
        margin-bottom: 20px;
        padding: 20px;
    }
    
    .section-title {
        font-size: 18px;
    }
    
    .scanner-laser {
        margin: 10px;
        height: 25px;
        width: 25px;
    }
    
    #webcodecam-canvas,
    #scanned-img {
        width: 100%;
        height: auto;
    }
    
    .scanner-wrapper,
    .result-image-wrapper {
        min-height: 180px;
    }
    
    .input-group-modern-scanner {
        flex-direction: column;
    }
    
    .input-group-modern-scanner .modern-input {
        border-radius: 12px !important;
        border-right: 2px solid #e0e0e0 !important;
        margin-bottom: 10px;
    }
    
    .input-group-modern-scanner .btn-submit {
        border-radius: 12px !important;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .logo-section h1 {
        font-size: 28px;
    }
    
    .subtitle {
        font-size: 14px;
    }
    
    .main-container {
        padding: 0 10px;
    }
    
    .modern-card {
        border-radius: 15px;
    }
    
    .controls-section {
        padding: 15px;
    }
    
    .modern-btn {
        padding: 10px 20px;
        font-size: 13px;
    }
    
    .scanner-card,
    .result-card {
        padding: 15px;
    }
    
    #webcodecam-canvas,
    #scanned-img {
        width: 100%;
        max-width: 280px;
        height: auto;
    }
    
    .scanner-wrapper,
    .result-image-wrapper {
        min-height: 150px;
    }
    
    .attendance-list .table-bordered th,
    .attendance-list .table-bordered td {
        font-size: 12px;
        padding: 8px;
    }
    
    .attendance-list .btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .modern-modal-body {
        padding: 15px;
    }
}

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

button {
    outline: none !important;
}

pre {
    border: 0;
    border-radius: 10px;
    background-color: #1a1a1a;
    margin: 0;
    line-height: 125%;
    color: whitesmoke;
    padding: 15px;
}

.image-url-section {
    margin-top: 15px;
}