/* ===================================
   GKJW Assets - Main Styles
   Global variables, base styles, utilities
   =================================== */

:root {
    --container-max: 780px;
    --card-border: #b2b2b2;
    --bg: #f8f9fa;
    --primary: #007bff;
    --secondary: #6c757d;
    --success: #28a745;
    --info: #17a2b8;
    --warning: #ffc107;
    --danger: #dc3545;
}

html, body {
    height: 100vh;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--bg);
    padding-bottom: 85px; /* Space for fixed bottom navbar */
}

main.container {
    width: 100%;
    max-width: var(--container-max);
    padding: 16px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    height: calc(100vh - 85px); /* Full height minus navbar space */
}

.container {
    width: 100%;
    max-width: var(--container-max);
    padding: 16px;
}

.section {
    background-color: #ffffff;
    padding: 24px 16px;
    border: 1.5px solid var(--card-border);
    border-radius: 0.25em;
    box-shadow: 0 5px 6px rgba(0, 0, 0, 0.08);
}

.footer-text {
    color: #666;
    margin-top: 30px;
    font-size: 11px;
    position: relative;
    text-align: center;
}

.message {
    margin-top: 20px;
}

.text-left {
    text-align: left !important;
}

.alert h5 {
    margin-bottom: 15px;
}

.alert code {
    background-color: rgba(0,0,0,0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

.alert-sm {
    padding: 8px 12px;
    margin-bottom: 12px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.search-results-container {
    animation: fadeInUp 0.5s ease-out;
}

/* Cards */
.card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    border: none;
    border-radius: 12px;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;
}

.card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    border-radius: 12px 12px 0 0 !important;
}

.card-footer {
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 12px 12px !important;
}

.card-img-top {
    object-fit: cover;
    transition: transform 0.3s ease;
}

.card:hover .card-img-top {
    transform: scale(1.05);
}

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

.table-responsive {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.modal-body img {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.img-placeholder {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 0.9em;
    border-radius: 8px;
}

.img-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Method Cards Enhancement */
.search-methods {
    margin-bottom: 25px;
}

.method-card.scan.active {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border-color: #28a745;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.2);
}

.method-card.search.active {
    background: linear-gradient(135deg, #e7f1ff, #d1ecf1);
    border-color: #007bff;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.2);
}

/* Scanner Container Styles */
#scanner-container {
    background: #ffffff;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 2px solid #e9ecef;
}

#scanner-container.active {
    border-color: #28a745;
    box-shadow: 0 4px 20px rgba(40, 167, 69, 0.2);
}

#my-qr-reader {
    border-radius: 10px;
    overflow: hidden;
}

.camera-status {
    padding: 10px 15px;
    border-radius: 8px;
    margin: 10px 0;
    font-weight: 500;
}

.camera-status.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.camera-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.camera-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.camera-status.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Search History Modal */
.search-history-popup {
    border-radius: 15px !important;
}

.search-history-modal {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    background-color: #f8f9fa;
    border-color: #007bff;
    transform: translateX(5px);
}

.history-item:last-child {
    margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding-bottom: 75px; /* Smaller space for mobile navbar */
    }
    
    main.container {
        height: calc(100vh - 75px); /* Adjust for smaller mobile navbar */
        padding: 12px;
    }
    
    .container {
        padding: 12px;
    }
    
    .search-methods {
        margin-bottom: 20px;
    }
    
    #scanner-container {
        padding: 15px;
        margin: 15px 0;
    }
    
    .search-history-modal {
        max-height: 300px;
    }
    
    .history-item {
        padding: 12px;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 576px) {
    body {
        padding-bottom: 70px;
    }
    
    main.container {
        height: calc(100vh - 70px);
        padding: 10px;
    }
    
    .container {
        padding: 10px;
    }
    
    .btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}
