/* DRD Stock PWA - Orange Theme Stylesheet (Fixed) */

:root {
    --primary: #ff8c42;
    --primary-light: #ffb347;
    --primary-dark: #ff7428;
    --secondary: #00A651;
    --danger: #EF4444;
    --warning: #F59E0B;
    --dark: #333333;
    --light: #F8F9FA;
    --white: #FFFFFF;
    --border: #E5E7EB;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #FFA500 0%, #FF8C00 100%);
    min-height: 100vh;
    color: var(--dark);
    overflow-x: hidden;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #FFA500 0%, #FF8C00 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-screen p {
    margin-top: 20px;
    font-size: 16px;
}

/* Screens */
.screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.screen.hidden {
    display: none;
}

/* Header */
.header {
    background: white;
    padding: 16px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: #FF8C00;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: var(--light);
}

.btn-back {
    background: transparent;
    border: none;
    font-size: 16px;
    font-weight: 600;
    color: #FF8C00;
    cursor: pointer;
    padding: 8px;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
}

/* Home Screen */
.home-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.button-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
    max-width: 500px;
}

.action-btn {
    background: white;
    border: none;
    border-radius: 20px;
    padding: 40px 20px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.action-btn:active {
    transform: scale(0.95);
}

.scan-btn {
    border-bottom: 6px solid #FF8C00;
}

.out-btn {
    border-bottom: 6px solid var(--danger);
}

.btn-icon-large {
    font-size: 64px;
    margin-bottom: 12px;
}

.btn-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 6px;
}

.btn-subtitle {
    font-size: 14px;
    color: #666;
}

/* Branding */
.branding {
    padding: 20px;
    text-align: center;
    color: white;
    font-size: 13px;
}

.branding strong {
    color: white;
    font-weight: 700;
}

.dev-credit {
    margin-top: 8px;
    font-size: 12px;
}

.hf-green {
    color: var(--secondary) !important;
}

/* Content */
.content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* Scan Section */
.scan-section {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.scan-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 16px;
}

.barcode-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.barcode-input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.barcode-input:focus {
    outline: none;
    border-color: #FF8C00;
}

/* Buttons */
.btn-primary {
    padding: 14px 24px;
    background: linear-gradient(135deg, #FFA500 0%, #FF8C00 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(255, 140, 0, 0.3);
}

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

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

.btn-secondary {
    padding: 14px 24px;
    background: white;
    color: #FF8C00;
    border: 2px solid #FF8C00;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-camera {
    width: 100%;
}

.btn-block {
    width: 100%;
}

/* Camera View */
.camera-view {
    background: black;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 20px;
}

.camera-view video {
    width: 100%;
    height: auto;
    display: block;
}

.camera-controls {
    padding: 16px;
    background: rgba(0, 0, 0, 0.8);
    text-align: center;
}

/* Result Container */
.result-container {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.result-card {
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.result-card.success {
    background: #D1FAE5;
    border-left: 4px solid var(--secondary);
}

.result-card.info {
    background: #FEF3C7;
    border-left: 4px solid var(--warning);
}

.result-card.error {
    background: #FEE2E2;
    border-left: 4px solid var(--danger);
}

.result-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.result-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.detail-label {
    font-weight: 600;
    color: #666;
}

.detail-value {
    font-weight: 700;
    color: var(--dark);
}

.stock-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

.stock-badge.in-stock {
    background: #D1FAE5;
    color: var(--secondary);
}

.stock-badge.out-of-stock {
    background: #FEE2E2;
    color: var(--danger);
}

.stock-badge.low-stock {
    background: #FEF3C7;
    color: var(--warning);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 500px;
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 20px;
    color: var(--dark);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-body {
    padding: 20px;
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--dark);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #FF8C00;
}

.readonly-input {
    background: var(--light);
    color: #666;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    animation: slideUp 0.3s;
}

.toast.hidden {
    display: none;
}

.toast.success {
    background: var(--secondary);
}

.toast.error {
    background: var(--danger);
}

.toast.warning {
    background: var(--warning);
}

/* Responsive */
@media (min-width: 768px) {
    .button-container {
        max-width: 600px;
    }
    
    .modal-content {
        border-radius: 20px;
        max-height: 80vh;
    }
    
    .modal {
        align-items: center;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

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

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

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

/* Custom Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    background: white;
    border: 2px solid var(--border);
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 200px;
    overflow-y: auto;
    width: calc(100% - 4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    margin-top: -2px;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: var(--light);
}

.autocomplete-item-main {
    flex: 1;
}

.autocomplete-item-title {
    font-weight: 600;
    color: var(--dark);
    font-size: 15px;
}

.autocomplete-item-subtitle {
    font-size: 13px;
    color: #666;
    margin-top: 2px;
}

.autocomplete-badge {
    background: #FEF3C7;
    color: var(--warning);
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.autocomplete-badge.needs-barcode {
    background: #FEE2E2;
    color: var(--danger);
}

.form-group {
    position: relative;
}

.field-hint {
    font-size: 12px;
    color: #666;
    font-weight: normal;
    margin-left: 8px;
}

.field-hint.success {
    color: var(--secondary);
    font-weight: 600;
}
