/**
 * SeQRsmart PWA - Custom Styles
 * Built on Bootstrap 5
 */

:root {
    /* Primary Colors */
    --color-primary: #FFFFFF;
    --color-secondary: #F0C82D;
    --color-tertiary: #AE8C20;
    --color-gradient-light: #F5D65D;
    --color-gradient-start: #FFF3B0;

    /* Text Colors */
    --color-font: #424242;
    --color-font-light: #6c757d;

    /* Functional Colors */
    --color-input-bg: #EBEBEB;
    --color-error: #dc3545;
    --color-success: #198754;
    --color-warning: #ffc107;

    /* Link */
    --color-link: #0d6efd;

    /* Shadows */
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-secondary: 0 5px 15px rgba(240, 200, 45, 0.4);
}

/* Global Styles */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--color-font);
    background-color: var(--color-primary);
    margin: 0;
    padding: 0;
}

#app-container {
    min-height: 100vh;
}

/* Loading Screen */
.loading-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(180deg, var(--color-gradient-start) 0%, var(--color-secondary) 100%);
}

/* ==================== LOGIN PAGE ==================== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(180deg, var(--color-gradient-start) 0%, var(--color-secondary) 100%);
    display: flex;
    flex-direction: column;
}

.login-logo {
    width: 120px;
    height: auto;
    margin-bottom: 10px;
}

.app-title {
    font-size: 1.75rem;
    font-weight: 400;
    color: var(--color-font);
    margin-bottom: 2rem;
}

.login-card {
    background: var(--color-primary);
    border-radius: 20px;
    box-shadow: var(--shadow-card);
    padding: 2rem;
    margin: 0 1rem;
}

/* Divider with text */
.divider-text {
    display: flex;
    align-items: center;
    color: var(--color-font-light);
    margin-bottom: 1.5rem;
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #dee2e6;
}

.divider-text span {
    padding: 0 1rem;
    font-size: 0.9rem;
}

/* Form Controls */
.form-control-custom {
    background-color: var(--color-input-bg);
    border: none;
    border-radius: 25px;
    padding: 0.75rem 1rem 0.75rem 3rem;
    font-size: 1rem;
}

.form-control-custom:focus {
    background-color: var(--color-input-bg);
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 0.25rem rgba(240, 200, 45, 0.25);
}

.input-group-custom {
    position: relative;
    margin-bottom: 1rem;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-font-light);
    z-index: 10;
}

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-font-light);
    cursor: pointer;
    z-index: 10;
}

/* Primary Button */
.btn-primary-custom {
    background-color: var(--color-secondary);
    border: none;
    border-radius: 25px;
    color: var(--color-font);
    font-weight: 700;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.btn-primary-custom:hover,
.btn-primary-custom:focus {
    background-color: var(--color-tertiary);
    color: var(--color-font);
    transform: translateY(-1px);
    box-shadow: var(--shadow-secondary);
}

.btn-primary-custom:disabled {
    background-color: #ccc;
    transform: none;
    box-shadow: none;
}

/* Link Styles */
.link-forgot {
    color: var(--color-link);
    text-decoration: none;
    font-size: 0.9rem;
}

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

/* Footer */
.login-footer {
    text-align: center;
    padding: 1rem;
    margin-top: auto;
}

.login-footer small {
    color: var(--color-font);
    font-size: 0.75rem;
}

.login-footer a {
    color: var(--color-link);
    text-decoration: none;
}

/* ==================== NAVBAR ==================== */
.navbar-custom {
    background: linear-gradient(180deg, var(--color-gradient-light) 0%, var(--color-secondary) 100%);
    padding: 0.75rem 1rem;
}

.navbar-custom .navbar-brand {
    font-weight: 600;
    color: var(--color-font);
}

.navbar-custom .btn-link {
    color: var(--color-font);
    text-decoration: none;
}

/* ==================== SIDE MENU (OFFCANVAS) ==================== */
.offcanvas-custom .offcanvas-header {
    background-color: var(--color-secondary);
    padding: 1.5rem;
}

.offcanvas-custom .offcanvas-title {
    font-weight: 600;
    color: var(--color-font);
}

.offcanvas-custom .list-group-item {
    border: none;
    padding: 1rem 1.5rem;
    color: var(--color-font);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.offcanvas-custom .list-group-item:hover {
    background-color: rgba(240, 200, 45, 0.1);
}

.offcanvas-custom .list-group-item i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

/* ==================== DASHBOARD ==================== */
.dashboard-page {
    min-height: 100vh;
    background-color: var(--color-primary);
}

.welcome-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-font);
    margin-bottom: 1rem;
}

.description-text {
    color: var(--color-font-light);
    font-size: 0.9rem;
    line-height: 1.5;
}

.dashboard-image {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    margin: 1.5rem 0;
}

.image-caption {
    font-size: 0.7rem;
    color: var(--color-font-light);
    margin-bottom: 1.5rem;
}

.btn-scan {
    background-color: var(--color-secondary);
    border: none;
    border-radius: 25px;
    color: var(--color-font);
    font-weight: 700;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-scan:hover {
    background-color: var(--color-tertiary);
    color: var(--color-font);
}

/* Floating Action Button */
.fab-menu {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--color-tertiary);
    border: none;
    color: var(--color-primary);
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.fab-menu:hover {
    background-color: var(--color-secondary);
}

/* ==================== SCANNER PAGE ==================== */
.scanner-page {
    min-height: 100vh;
    background: #000;
    display: flex;
    flex-direction: column;
}

.scanner-container {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

#qr-reader {
    width: 100%;
    flex: 1;
}

#qr-reader video {
    width: 100% !important;
    height: auto !important;
    object-fit: cover;
}

#qr-reader__scan_region {
    background: transparent !important;
}

#qr-reader__dashboard {
    display: none !important;
}

.scanner-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
}

.scanner-controls .btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-controls .btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.zoom-slider {
    width: 100%;
    margin-top: 1rem;
}

.zoom-slider input[type="range"] {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.zoom-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--color-secondary);
    border-radius: 50%;
    cursor: pointer;
}

/* ==================== CHECKPOINT FORM ==================== */
.checkpoint-form-page {
    min-height: 100vh;
    background-color: var(--color-primary);
}

.checkpoint-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-font);
    margin-bottom: 1.5rem;
}

.btn-camera {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-gradient-light), var(--color-secondary));
    border: none;
    color: var(--color-font);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-camera:hover {
    background: linear-gradient(135deg, var(--color-secondary), var(--color-tertiary));
}

.form-select-custom {
    background-color: var(--color-input-bg);
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

.form-select-custom:focus {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 0.25rem rgba(240, 200, 45, 0.25);
}

.form-textarea-custom {
    background-color: var(--color-input-bg);
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    resize: none;
}

.form-textarea-custom:focus {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 0.25rem rgba(240, 200, 45, 0.25);
}

.image-preview-container {
    position: relative;
    margin: 1rem 0;
}

.image-preview {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 10px;
}

.btn-remove-image {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(220, 53, 69, 0.9);
    border: none;
    color: white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==================== RESULT PAGE ==================== */
.result-page {
    min-height: 100vh;
    background-color: var(--color-primary);
    display: flex;
    flex-direction: column;
}

.result-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.result-icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
}

.result-icon.success {
    color: var(--color-success);
}

.result-icon.error {
    color: var(--color-error);
}

.result-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.result-details {
    color: var(--color-font-light);
    text-align: center;
    margin-bottom: 2rem;
}

.result-actions {
    width: 100%;
    max-width: 300px;
}

.result-actions .btn {
    width: 100%;
    margin-bottom: 0.75rem;
    border-radius: 25px;
    padding: 0.75rem;
}

/* ==================== HISTORY PAGE ==================== */
.history-page {
    min-height: 100vh;
    background-color: #f8f9fa;
}

.history-filters {
    background: var(--color-primary);
    padding: 1rem;
    box-shadow: var(--shadow-card);
}

.search-input-group {
    position: relative;
}

.search-input-group .form-control {
    padding-left: 2.5rem;
    border-radius: 10px;
    border: 1px solid #dee2e6;
}

.search-input-group .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-font-light);
}

.filter-select {
    border-radius: 10px;
    border: 1px solid #dee2e6;
}

.history-list {
    padding: 1rem;
}

.history-item {
    background: var(--color-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    margin-bottom: 1rem;
    overflow: hidden;
    border-left: 4px solid transparent;
}

.history-item.status-pass {
    border-left-color: var(--color-success);
}

.history-item.status-fail {
    border-left-color: var(--color-error);
}

.history-item-content {
    display: flex;
    padding: 1rem;
    gap: 1rem;
}

.history-thumbnail {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
}

.history-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.history-details {
    flex: 1;
    min-width: 0;
}

.history-details p {
    margin: 0 0 0.25rem 0;
    font-size: 0.875rem;
}

.history-details .label {
    font-weight: 600;
    color: var(--color-font);
}

.history-details .value {
    color: var(--color-font-light);
}

.history-details .qr-code {
    word-break: break-all;
    font-size: 0.75rem;
}

.badge-status {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
}

.badge-status.pass {
    background-color: rgba(25, 135, 84, 0.1);
    color: var(--color-success);
}

.badge-status.fail {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--color-error);
}

.btn-resend {
    background-color: var(--color-warning);
    border: none;
    color: var(--color-font);
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    margin-top: 0.5rem;
}

/* ==================== PROFILE PAGE ==================== */
.profile-page {
    min-height: 100vh;
    background-color: #f8f9fa;
}

.profile-header {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(180deg, var(--color-gradient-light) 0%, var(--color-secondary) 100%);
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--color-primary);
    box-shadow: var(--shadow-card);
}

.profile-list {
    padding: 1rem;
}

.profile-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--color-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-secondary);
    margin-bottom: 1rem;
}

.profile-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--color-font);
    margin-right: 1rem;
}

.profile-content {
    flex: 1;
}

.profile-label {
    display: block;
    font-size: 0.75rem;
    color: var(--color-font-light);
    margin-bottom: 0.125rem;
}

.profile-value {
    display: block;
    font-weight: 500;
    color: var(--color-font);
}

.profile-item.logout {
    cursor: pointer;
}

.profile-item.logout .profile-icon,
.profile-item.logout .profile-label {
    color: var(--color-error);
}

/* ==================== SEARCH PAGE ==================== */
.search-page {
    min-height: 100vh;
    background-color: #f8f9fa;
}

.search-results {
    padding: 1rem;
}

.search-result-item {
    background: var(--color-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    margin-bottom: 0.75rem;
    padding: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.search-result-item:hover {
    transform: translateY(-2px);
}

.search-result-item .name {
    font-weight: 600;
    color: var(--color-font);
    margin-bottom: 0.25rem;
}

.search-result-item .map-name {
    font-size: 0.875rem;
    color: var(--color-font-light);
}

/* ==================== UTILITIES ==================== */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Toast notifications */
.toast {
    border-radius: 12px;
}

/* Loading button state */
.btn .spinner-border {
    width: 1rem;
    height: 1rem;
}

.btn.loading .btn-text {
    display: none;
}

.btn.loading .spinner-border {
    display: inline-block !important;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-font-light);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Image Modal */
.modal-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

/* Recaptcha container */
.recaptcha-container {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
    transform: scale(0.9);
    transform-origin: center;
}

/* Hide elements */
.d-none {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 375px) {
    .login-card {
        padding: 1.5rem;
    }

    .login-logo {
        width: 100px;
    }

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