/* ============================================
   SISTEMA DE TICKETS - VEGASOFTWORKS
   Estilos completos y responsive
   ============================================ */

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #dbeafe;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f0f4ff 0%, #e0e7ff 100%);
    color: var(--gray-800);
    min-height: 100vh;
    line-height: 1.6;
}

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

/* ============================================
   HEADER
   ============================================ */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 12px;
}

.header p {
    color: var(--gray-500);
    font-size: 1rem;
    max-width: 500px;
    margin: 0 auto;
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 30px;
    align-items: start;
}

.form-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

/* ============================================
   FORMULARIO
   ============================================ */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

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

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 0.9rem;
    pointer-events: none;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 12px 14px 12px 40px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--gray-50);
    transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px var(--primary-light);
}

textarea {
    padding-left: 14px;
    resize: vertical;
    min-height: 120px;
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    appearance: none;
    padding-right: 40px;
    cursor: pointer;
}

.select-arrow {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 0.7rem;
    pointer-events: none;
}

/* ============================================
   PRIORIDAD
   ============================================ */
.priority-group {
    display: flex;
    gap: 10px;
}

.priority-option {
    flex: 1;
    cursor: pointer;
}

.priority-option input {
    display: none;
}

.priority-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    background: white;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-600);
}

.priority-icon {
    font-size: 1.3rem;
}

.priority-option input:checked + .priority-card.baja {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

.priority-option input:checked + .priority-card.media {
    border-color: var(--warning);
    background: #fef3c7;
    color: #b45309;
}

.priority-option input:checked + .priority-card.urgente {
    border-color: var(--danger);
    background: #fee2e2;
    color: #b91c1c;
}

.priority-card:hover {
    border-color: var(--gray-300);
    transform: translateY(-1px);
}

/* ============================================
   BOTONES
   ============================================ */
.btn-submit {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    display: inline-block;
    padding: 10px 20px;
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--gray-200);
    border-color: var(--gray-300);
}

.btn-text-link {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9rem;
}

/* ============================================
   MENSAJE DE ÉXITO
   ============================================ */
.success-message {
    text-align: center;
    padding: 40px 20px;
    animation: fadeIn 0.5s ease;
}

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

.success-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.success-message h3 {
    font-size: 1.4rem;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.success-message p {
    color: var(--gray-600);
    margin-bottom: 8px;
}

#ticketNumber {
    color: var(--primary);
    font-size: 1.3rem;
}

.success-note {
    font-size: 0.9rem;
    color: var(--gray-500);
    max-width: 400px;
    margin: 0 auto 24px;
}

.success-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================
   PANEL DE CONTROL
   ============================================ */
.panel-control {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 20px;
}

.panel-control h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--gray-100);
}

.stat-card {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--gray-100);
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gray-900);
}

.panel-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.panel-link {
    display: block;
    padding: 10px 14px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.panel-link:hover {
    background: var(--primary);
    color: white;
}

.admin-link {
    background: var(--gray-100);
    color: var(--gray-600);
}

.admin-link:hover {
    background: var(--gray-800);
    color: white;
}

/* ============================================
   SEGUIMIENTO / TRACKER
   ============================================ */
.tracker-layout {
    max-width: 800px;
    margin: 0 auto;
}

.search-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
}

.search-wrapper {
    display: flex;
    gap: 12px;
}

.search-wrapper input {
    flex: 1;
    padding-left: 14px;
}

.btn-search {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-search:hover {
    background: var(--primary-dark);
}

.tickets-list {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-lg);
}

.tickets-list h3 {
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.ticket-card {
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.ticket-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ticket-number {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}

.ticket-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-abierto { background: #dbeafe; color: #1e40af; }
.status-en_proceso { background: #fef3c7; color: #b45309; }
.status-resuelto { background: #d1fae5; color: #065f46; }
.status-cerrado { background: var(--gray-200); color: var(--gray-600); }

.ticket-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    font-size: 0.85rem;
    color: var(--gray-600);
}

.ticket-info span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ticket-description {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-100);
    font-size: 0.9rem;
    color: var(--gray-700);
}

.no-tickets {
    text-align: center;
    padding: 40px;
    color: var(--gray-500);
}

.back-link {
    text-align: center;
    margin-top: 24px;
}

.back-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.back-link a:hover {
    text-decoration: underline;
}

/* ============================================
   ADMIN PANEL
   ============================================ */
.admin-login {
    max-width: 400px;
    margin: 0 auto;
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

.login-hint {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-top: 8px;
}

.admin-filters {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 24px;
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.btn-report {
    padding: 10px 20px;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: auto;
}

.btn-report:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.tickets-table-wrapper {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.tickets-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.tickets-table th {
    background: var(--gray-50);
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-600);
    border-bottom: 1px solid var(--gray-200);
}

.tickets-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

.tickets-table tr:hover td {
    background: var(--gray-50);
}

.btn-action {
    padding: 6px 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-edit {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.btn-edit:hover {
    background: var(--primary);
    color: white;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-400);
}

.modal-close:hover {
    color: var(--gray-700);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-400);
    font-size: 0.85rem;
}

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

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .header h1 {
        font-size: 1.6rem;
    }

    .panel-control {
        position: static;
    }

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

    .admin-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-report {
        margin-left: 0;
    }

    .tickets-table {
        font-size: 0.8rem;
    }

    .tickets-table th,
    .tickets-table td {
        padding: 10px 8px;
    }
}

/* ============================================
   UTILIDADES
   ============================================ */
.hidden {
    display: none !important;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.error-message {
    background: #fee2e2;
    color: #b91c1c;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
}
