/* styles.css - Sistema de Gestión de Vouchers */

:root {
    --bg-primary: #000;
    --bg-secondary: #111;
    --bg-tertiary: #222;
    --text-primary: #fff;
    --text-secondary: #888;
    --text-error: #f66;
    --text-success: #7fffd4;
    --border-color: #444;
	--border-colorrf: #00FFFF;
    --btn-primary: #007bff;
    --btn-primary-hover: #0056b3;
    --btn-danger: #c82333;
    --btn-danger-hover: #a71b28;
}

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

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem;
}

/* ========== HEADER ========== */
header {
    background: var(--bg-secondary);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

header .user {
    font-weight: bold;
    color: var(--text-success);
}

/* ========== BUTTONS ========== */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 5px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-size: 1rem;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--btn-primary);
    color: var(--text-primary);
}

.btn-primary:hover:not(:disabled) {
    background: var(--btn-primary-hover);
}

.btn-secondary {
    background: #6c757d;
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

.btn-light {
    background: #f8f9fa;
    color: #212529;
}

.btn-light:hover:not(:disabled) {
    background: #e2e6ea;
}

.btn-danger {
    background: var(--btn-danger);
    color: var(--text-primary);
}

.btn-danger:hover:not(:disabled) {
    background: var(--btn-danger-hover);
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-large {
    padding: 1.6rem 2.4rem;
    font-size: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.35);
}

/* ========== FORMS ========== */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1rem;
}

.form-controlrf {
    width: 100%;
    padding: 0.75rem;
    border-radius: 5px;
    border: 1px solid var(--border-colorrf);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--btn-primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
}

input[readonly].form-control {
    background: #0a0a0a;
    cursor: not-allowed;
    opacity: 0.7;
}

/* ========== TABLES ========== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
}

thead {
    background: var(--bg-tertiary);
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: bold;
    color: var(--text-success);
}

tbody tr:hover {
    background: var(--bg-tertiary);
}

/* ========== LOGIN ========== */
.login-box {
    max-width: 400px;
    margin: 5rem auto;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.5rem;
    color: var(--text-success);
}

.login-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: center;
    padding: 0.5rem;
    border-top: 1px solid var(--border-color);
}

/* ========== MEDIA GRID ========== */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 1rem;
}

.media-item {
    position: relative;
    background: var(--bg-secondary);
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.media-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.media-item img,
.media-item video {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--bg-primary);
    display: block;
    cursor: pointer;
}

.media-label {
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
}

.media-state {
    font-size: 0.7rem;
    color: var(--text-success);
    margin-bottom: 0.25rem;
}

.media-actions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.media-actions button {
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    border: none;
    background: var(--btn-primary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.media-actions button:hover {
    background: var(--btn-primary-hover);
}

.media-placeholder {
    display: block;
    width: 100%;
    height: 100px;
    background: var(--bg-secondary);
    border-radius: 4px;
    border: 1px dashed var(--border-color);
}

.thumbnail-loading {
    width: 100%;
    height: 100px;
    background: linear-gradient(90deg, #111 25%, #222 50%, #111 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========== SEARCH FORM ========== */
.search {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.search input[type="text"] {
    flex-grow: 1;
    padding: 0.5rem;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    min-width: 200px;
}

.search button {
    padding: 0.5rem 1rem;
}

/* ========== SIGNATURE PAD ========== */
.signature-container {
    margin-bottom: 1.5rem;
}

#signaturePad {
    background: #111;
    border: 2px solid #555;
    border-radius: 8px;
    width: 100%;
    max-width: 600px;
    height: 220px;
    touch-action: none;
    cursor: crosshair;
    display: block;
}

.signature-controls {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========== CAMERA/QR READER ========== */
#cameraContainer, .qr-reader-container {
    position: relative;
    margin-top: 1rem;
    max-width: 100%;
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid var(--btn-primary);
    animation: slideDown 0.3s ease-out;
}

#cameraContainer video, .qr-reader-container video {
    width: 100%;
    max-width: 500px;
    border-radius: 6px;
    background: var(--bg-primary);
    display: block;
    margin: 0 auto;
}

.qr-reader-container {
    max-width: 400px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== UPLOAD PROGRESS ========== */
.upload-progress {
    margin-top: 8px;
    padding: 0.75rem;
    background: rgba(0, 123, 255, 0.1);
    border: 1px solid var(--btn-primary);
    border-radius: 4px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--btn-primary);
    transition: width 0.3s ease;
}

.progress-text {
    color: var(--text-primary);
    text-align: center;
    font-size: 0.9rem;
}

/* ========== AUTOSAVE INDICATOR ========== */
.autosave-indicator {
    display: inline-block;
    margin-left: 0.5rem;
    color: var(--text-success);
    font-size: 1.2rem;
    animation: fadeOut 2s ease-in-out;
}

@keyframes fadeOut {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

/* ========== FOOTER ========== */
footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
}

/* ========== HR SEPARATORS ========== */
hr[color="red"] {
    border: none;
    height: 2px;
    background: #c82333;
    margin: 1.5rem 0;
}

hr[color="green"] {
    border: none;
    height: 2px;
    background: #28a745;
    margin: 1.5rem 0;
}

hr[color="orange"] {
    border: none;
    height: 2px;
    background: #fd7e14;
    margin: 1.5rem 0;
}

hr[color="yellow"] {
    border: none;
    height: 2px;
    background: #ffc107;
    margin: 1.5rem 0;
}

hr[color="blue"] {
    border: none;
    height: 2px;
    background: #007bff;
    margin: 1.5rem 0;
}

/* ========== WHATSAPP BUTTON ========== */
#btnCompartirWhatsApp {
    background: #25D366 !important;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

#btnCompartirWhatsApp:not(:disabled):hover {
    background: #20BA5A !important;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

#btnCompartirWhatsApp:disabled {
    background: #888 !important;
    cursor: not-allowed;
    opacity: 0.5;
}

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

.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.p-1 { padding: 1rem; }

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* ========== RESPONSIVE - TABLETS ========== */
@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }
    
    header {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .btn-large {
        padding: 1rem 1.5rem;
        font-size: 1.5rem;
        width: 100%;
    }
    
    table {
        font-size: 0.85rem;
    }
    
    th, td {
        padding: 0.5rem 0.3rem;
    }
    
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .search {
        flex-direction: column;
    }
    
    .search input[type="text"] {
        min-width: 100%;
    }
    
    #signaturePad {
        height: 180px;
    }
}

/* ========== RESPONSIVE - MÓVILES ========== */
@media (max-width: 520px) {
    body {
        font-size: 0.95rem;
    }
    
    .container {
        padding: 0.25rem;
    }
    
    .btn-large {
        padding: 0.875rem 1.25rem;
        font-size: 1.25rem;
    }
    
    .login-box {
        margin: 2rem auto;
        padding: 1.5rem;
    }
    
    table {
        font-size: 0.75rem;
    }
    
    th, td {
        padding: 0.4rem 0.2rem;
    }
    
    .form-control,
    input[type="text"],
    select,
    textarea {
        font-size: 16px;
    }
    
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }
    
    #signaturePad {
        height: 150px;
    }
}

/* ========== PRINT ========== */
@media print {
    body {
        background: white;
        color: black;
    }
    
    header, footer, .btn, .search {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
    }
}
