/* css/styles.css - Sistema de Gestión de Licencias Mac */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f7;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* Login Styles */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    animation: fadeInUp 0.6s ease;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 28px;
    color: #1d1d1f;
    margin-bottom: 10px;
}

.login-header p {
    color: #86868b;
    font-size: 16px;
}

.login-form {
    margin-top: 30px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 5px;
    cursor: pointer;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #0071e3;
    box-shadow: 0 0 0 3px rgba(0,113,227,0.1);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background-color: #0071e3;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-login:hover {
    background-color: #0051c3;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0,113,227,0.3);
}

.error-message {
    background-color: #fee;
    color: #c33;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    display: none;
}

.success-message {
    background-color: #e6f4ea;
    color: #1e8e3e;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    display: none;
}

/* Main App Styles */
.app-container {
    display: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    background-color: #fff;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.header h1 {
    font-size: 28px;
    color: #1d1d1f;
    white-space: nowrap;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.user-name {
    font-weight: 500;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.btn-logout {
    background-color: #ff3b30;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(255, 59, 48, 0.2);
}

.btn-logout:hover {
    background-color: #e6342b;
    box-shadow: 0 4px 10px rgba(255, 59, 48, 0.3);
    transform: translateY(-1px);
}

.btn-users {
    background-color: #5856d6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
    box-shadow: 0 2px 5px rgba(88, 86, 214, 0.2);
}

.btn-users:hover {
    background-color: #4745c0;
    box-shadow: 0 4px 10px rgba(88, 86, 214, 0.3);
    transform: translateY(-1px);
}

.btn-green {
    background-color: #34c759;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
    box-shadow: 0 2px 5px rgba(52, 199, 89, 0.2);
}

.btn-green:hover {
    background-color: #2ca048;
    box-shadow: 0 4px 10px rgba(52, 199, 89, 0.3);
    transform: translateY(-1px);
}

.search-section {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    position: relative;
    min-width: 300px;
}

.search-box input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #0071e3;
    box-shadow: 0 0 0 3px rgba(0,113,227,0.1);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #86868b;
}

.btn-new {
    background-color: #0071e3;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-new:hover {
    background-color: #0051c3;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0,113,227,0.3);
}

.btn-clear {
    background-color: #86868b;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: none;
}

.btn-clear:hover {
    background-color: #6e6e73;
    transform: translateY(-1px);
}

.btn-scan {
    background-color: #34c759;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 45px;
}

.btn-scan:hover {
    background-color: #2ca048;
    transform: translateY(-1px);
}

.table-container {
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: #f9f9fa;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #1d1d1f;
    border-bottom: 1px solid #e7e7e8;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f2;
}

tr:hover {
    background-color: #f9f9fa;
}

.app-link {
    color: #0071e3;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.app-link:hover {
    color: #0051c3;
    text-decoration: underline;
}

.actions {
    display: flex;
    gap: 10px;
}

.btn-action {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-edit {
    background-color: #f0f0f2;
    color: #333;
}

.btn-edit:hover {
    background-color: #e0e0e2;
}

.btn-delete {
    background-color: #ff3b30;
    color: white;
}

.btn-delete:hover {
    background-color: #e6342b;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

/* Modal de cámara con z-index más alto */
#cameraModal {
    z-index: 2000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease;
}

.modal h2 {
    margin-bottom: 20px;
    color: #1d1d1f;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

.btn-modal {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-cancel {
    background-color: #f0f0f2;
    color: #333;
}

.btn-cancel:hover {
    background-color: #e0e0e2;
}

.btn-save {
    background-color: #0071e3;
    color: white;
}

.btn-save:hover {
    background-color: #0051c3;
}

.btn-confirm-delete {
    background-color: #ff3b30;
    color: white;
}

.btn-confirm-delete:hover {
    background-color: #e6342b;
}

.delete-message {
    margin: 20px 0;
    padding: 15px;
    background-color: #fff3cd;
    border-radius: 8px;
    border: 1px solid #ffeaa7;
}

.key-highlight {
    font-weight: bold;
    color: #ff3b30;
    background-color: #ffe5e5;
    padding: 2px 6px;
    border-radius: 4px;
}

.lifetime-badge {
    background-color: #34c759;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #86868b;
}

/* Camera Modal Styles */
.camera-container {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 60px; /* Espacio para los botones */
}

.camera-modal-content {
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

#video {
    width: 100%;
    max-width: 500px;
    border-radius: 8px;
    margin-bottom: 20px;
}

#canvas {
    display: none;
}

.camera-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 15px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1001;
}

.btn-capture {
    background-color: #34c759;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-capture:hover {
    background-color: #2ca048;
}

.ocr-result {
    margin-top: 20px;
    padding: 15px;
    background-color: #f0f0f2;
    border-radius: 8px;
    text-align: left;
    max-height: 300px;
    overflow-y: auto;
}

.ocr-result h4 {
    margin-bottom: 10px;
    color: #333;
    position: sticky;
    top: 0;
    background: #f0f0f2;
    padding: 5px 0;
}

.detected-item {
    font-family: monospace;
    font-size: 16px;
    padding: 10px;
    background-color: #fff;
    border: 1px solid #d2d2d7;
    border-radius: 6px;
    margin: 8px 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.detected-item:hover {
    background-color: #0071e3;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,113,227,0.3);
}

.processing {
    color: #0071e3;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Estilos adicionales para la tabla de usuarios */
.table-container table {
    font-size: 14px;
}

.table-container td {
    padding: 12px 15px;
}

/* Paginación */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: #f9f9fa;
    border-top: 1px solid #e7e7e8;
}

.pagination-info {
    color: #86868b;
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.pagination-btn {
    padding: 8px 16px;
    border: 1px solid #d2d2d7;
    background-color: white;
    color: #333;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #f0f0f2;
    border-color: #0071e3;
}

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

.pagination-btn.active {
    background-color: #0071e3;
    color: white;
    border-color: #0071e3;
}

.page-numbers {
    display: flex;
    gap: 5px;
}

.page-number {
    padding: 6px 12px;
    border: 1px solid #d2d2d7;
    background-color: white;
    color: #333;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    min-width: 40px;
    text-align: center;
}

.page-number:hover {
    background-color: #f0f0f2;
    border-color: #0071e3;
}

.page-number.active {
    background-color: #0071e3;
    color: white;
    border-color: #0071e3;
}

.page-dots {
    padding: 6px 12px;
    color: #86868b;
}

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

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

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to { 
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Media Queries */
@media (max-width: 768px) {
    .header-top {
        flex-direction: column;
        gap: 15px;
    }
    
    .header-actions {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }
    
    .header-actions {
        width: 100%;
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .header-actions button {
        flex: 1;
        min-width: 140px;
        margin-right: 0;
        margin-bottom: 0;
    }
    
    .btn-green, .btn-users, .btn-logout {
        margin-right: 0;
        margin-bottom: 0;
        justify-content: center;
    }
    
    .user-info {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .user-name {
        width: 100%;
        margin-bottom: 10px;
        justify-content: center;
    }
    
    #btnUsers {
        min-width: 140px;
    }

    .search-section {
        flex-direction: column;
    }

    .search-box {
        min-width: 100%;
    }

    .btn-new {
        width: 100%;
    }

    .btn-users {
        width: 100%;
        margin-bottom: 10px;
    }

    .table-container {
        overflow-x: auto;
    }

    table {
        min-width: 800px;
    }
    
    /* Paginación móvil */
    .pagination-container {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .page-numbers {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    /* Modal optimizations for mobile */
    .modal-content {
        max-height: 85vh;
        overflow-y: auto;
        margin: 5vh 10px;
        width: calc(100% - 20px);
        max-width: calc(100% - 20px);
        transform: translate(-50%, -50%) !important;
    }
    
    .modal-buttons {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 15px 0;
        margin-top: 15px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }
    
    /* Camera modal specific */
    .camera-modal-content {
        max-width: 100vw;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
        height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    .camera-container {
        flex: 1;
        overflow-y: auto;
        padding-bottom: 80px;
    }
    
    #video {
        max-width: 100%;
        height: auto;
        max-height: 40vh;
    }
    
    .ocr-result {
        max-height: 30vh;
        margin: 15px;
    }
    
    .camera-buttons {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 15px;
        background: white;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
        z-index: 1002;
        border-top: 1px solid #e0e0e0;
    }
    
    .btn-capture, .btn-modal {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .detected-item {
        font-size: 15px;
        padding: 12px;
    }
    
    .modal h2 {
        font-size: 22px;
        margin-bottom: 10px;
    }
    
    #scanHint {
        font-size: 13px;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    /* Ajustes adicionales para móviles pequeños */
    .modal-content h2 {
        font-size: 20px;
    }
    
    /* Ajustes de cámara para móviles pequeños */
    .camera-header h2 {
        font-size: 16px;
    }
    
    #scanHint {
        font-size: 12px;
    }
    
    .btn-capture-iphone {
        width: 70px;
        height: 70px;
        border: 4px solid rgba(255,255,255,0.3);
    }
    
    .btn-capture-iphone::before {
        width: 60px;
        height: 60px;
    }
    
    .btn-close-camera {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    .camera-controls {
        padding: 20px 15px 40px;
    }
    
    .camera-spacer {
        width: 45px;
        height: 45px;
    }
    
    .ocr-result {
        bottom: 130px;
        left: 15px;
        right: 15px;
        font-size: 14px;
    }
    
    .detected-item {
        font-size: 13px;
        padding: 10px;
    }
    
    .form-group input {
        font-size: 16px; /* Previene el zoom en iOS */
    }
    
    /* Ajustes de paginación para móviles pequeños */
    .pagination-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .page-number {
        padding: 5px 8px;
        font-size: 12px;
        min-width: 32px;
    }
    
    .pagination-info {
        font-size: 12px;
    }
    
    /* Ajuste de botones del header en móviles pequeños */
    .header-actions button {
        width: 100%;
        min-width: unset;
    }
    
    .btn-green, .btn-users, .btn-logout {
        font-size: 13px;
        padding: 8px 16px;
    }
    
    .header h1 {
        font-size: 22px;
    }
    
    /* Ocultar texto en botones de paginación en móviles muy pequeños */
    @media (max-width: 380px) {
        #btnFirst, #btnLast {
            display: none;
        }
        
        #btnPrev {
            padding: 6px 12px;
        }
        
        #btnNext {
            padding: 6px 12px;
        }
    }
}
