/* TAMSIA Subscriptions - Diseño Profesional */

/* Variables - Colores TAMSIA */
:root {
    --bg-dark: #000000;
    --bg-card: #0a0a0a;
    --bg-input: #121212;
    --bg-hover: #1a1a1a;
    --border-color: #2a2a2a;
    --border-light: #3a3a3a;
    --text-white: #ffffff;
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --text-muted: #707070;
    --accent-teal: #05aab5;
    --accent-teal-hover: #04949e;
    --accent-teal-light: rgba(5, 170, 181, 0.15);
    --accent-green: #22c55e;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --font-sans: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --transition: all 0.2s ease;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    font-size: 14px;
}

/* Layout Principal */
.app-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.brand {
    display: flex;
    align-items: center;
}

.brand-logo {
    height: 32px;
    width: auto;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: rgba(0,0,0,0.2);
}

.user-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--accent-teal);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
}

/* Área Principal */
.main-area {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-header {
    padding: 20px 32px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-white);
}

.header-actions {
    display: flex;
    gap: 12px;
}

.main-content {
    flex: 1;
    padding: 24px 32px;
    overflow-y: auto;
}

/* Formularios */
.form-section {
    margin-bottom: 24px;
}

.form-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

input, select, textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-teal);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

input::placeholder {
    color: var(--text-muted);
}

.input-group {
    display: flex;
    gap: 8px;
}

.input-group input {
    flex: 1;
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-teal);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-teal-hover);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.btn-success {
    background: var(--accent-green);
    color: white;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    padding: 8px;
    min-width: 36px;
}

.btn-block {
    width: 100%;
}

/* Tabla de Suscripciones */
.subscriptions-table {
    width: 100%;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.table-header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 1fr 1fr 120px;
    gap: 16px;
    padding: 14px 20px;
    background: rgba(0,0,0,0.3);
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.subscription-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 1fr 1fr 120px;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    transition: var(--transition);
}

.subscription-row:hover {
    background: var(--bg-hover);
}

.subscription-row:last-child {
    border-bottom: none;
}

.sub-name {
    font-weight: 600;
    color: var(--text-white);
}

.sub-id {
    font-size: 12px;
    color: var(--text-muted);
}

.sub-customer {
    color: var(--text-primary);
}

.sub-plan {
    color: var(--text-secondary);
}

.sub-total {
    font-weight: 600;
    color: var(--accent-green);
}

.sub-date {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-draft, .status-new {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
}

.status-progress, .status-in-progress, .status-active {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.status-closed, .status-paused {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-secondary);
}

.status-cancel, .status-cancelled {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

/* Productos */
.products-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.product-item {
    display: grid;
    grid-template-columns: 1fr 80px 80px auto;
    gap: 8px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius);
    align-items: center;
}

.product-item select,
.product-item input {
    background: var(--bg-dark);
}

/* Search Results */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    margin-top: 4px;
    box-shadow: var(--shadow);
}

.search-result-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.search-result-item:hover {
    background: var(--bg-hover);
}

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

.search-container {
    position: relative;
}

/* Mensajes */
.message {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-top: 16px;
    font-size: 13px;
}

.error-message {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.success-message {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Loading */
.loading {
    text-align: center;
    padding: 48px;
    color: var(--text-secondary);
}

.loading-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-teal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 64px 32px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Panel Permisos */
.permissions-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 24px;
}

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

.permissions-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-white);
}

.permissions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.permission-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: var(--radius);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-white);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 12px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.radio-label:hover {
    border-color: var(--border-light);
}

.radio-label input {
    width: auto;
}

.radio-label input:checked + span {
    color: var(--accent-teal);
}

/* Section Label */
.section-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 20px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 40px;
}

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

.login-logo {
    width: 64px;
    height: 64px;
    background: var(--accent-teal);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 16px;
}

.login-logo-img {
    max-width: 200px;
    height: auto;
    margin: 0 auto 24px;
    display: block;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-white);
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Responsive */
@media (max-width: 1200px) {
    .app-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: fixed;
        left: -100%;
        width: 380px;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .table-header,
    .subscription-row {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .table-header > *:nth-child(n+3),
    .subscription-row > *:nth-child(n+3) {
        display: none;
    }
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .main-header {
        padding: 16px 20px;
    }
    
    .main-content {
        padding: 16px 20px;
    }
    
    .product-item {
        grid-template-columns: 1fr;
    }
}

/* Selector de Etiquetas */
.tags-selector {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 8px;
    min-height: 42px;
}

.tags-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.tags-selected:empty {
    display: none;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--accent-teal);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.tag-chip-remove {
    cursor: pointer;
    opacity: 0.7;
    font-size: 14px;
    line-height: 1;
}

.tag-chip-remove:hover {
    opacity: 1;
}

.tags-input-wrapper {
    position: relative;
}

.tags-input-wrapper input {
    border: none;
    background: transparent;
    padding: 4px 0;
    width: 100%;
}

.tags-input-wrapper input:focus {
    outline: none;
    box-shadow: none;
}

.tags-dropdown {
    position: absolute;
    top: 100%;
    left: -8px;
    right: -8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    margin-top: 4px;
    box-shadow: var(--shadow);
}

.tag-option {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.tag-option:hover {
    background: var(--bg-hover);
}

.tag-option:last-child {
    border-bottom: none;
}

.tag-option-create {
    color: var(--accent-teal);
    font-weight: 500;
}

.tag-option-check {
    color: var(--accent-green);
}

/* Antiguos estilos que necesitan mantenerse para compatibilidad */
.panel { display: none; }
.panel-permissions { display: none !important; }
.panel-create { display: none; }
.panel-list { display: none; }
.panel-header { display: none; }
.panel-content { display: none; }
.main-container { display: none; }
.header { display: none; }
.header-content { display: none; }
.logo { display: none; }
.logo-icon { display: none; }
.logo-text { display: none; }
.logo-accent { display: none; }
.header-actions { display: none; }
