/**
 * Estilos app móvil SegurHorario
 * Mismos colores que la web (styles.css)
 */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #10b981;
    --secondary-dark: #059669;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --accent-color: #ec4899;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --border-light: #475569;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --radius: 16px;
    --radius-sm: 12px;
    --nav-height: 64px;
    --header-height: 56px;
    --safe-top: env(safe-area-inset-top, 0);
    --safe-bottom: env(safe-area-inset-bottom, 0);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.4;
    overflow-x: hidden;
    padding-top: var(--safe-top);
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
}

body.app-login {
    padding-bottom: var(--safe-bottom);
}

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--header-height) + var(--safe-top));
    padding-top: var(--safe-top);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.app-header h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}
.app-header .logo-icon { margin-right: 8px; font-size: 1.5rem; }

.app-content {
    padding: calc(var(--header-height) + var(--safe-top) + 16px) 16px 24px;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
}

.app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    justify-content: space-around;
    z-index: 100;
}
.app-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    transition: color 0.2s;
    min-height: 64px;
}
.app-nav a:hover, .app-nav a.active { color: var(--primary-light); }
.app-nav a .nav-icon { font-size: 1.4rem; margin-bottom: 2px; }

.app-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}
.app-card h2, .app-card h3 { margin: 0 0 12px 0; font-size: 1rem; color: var(--text-primary); }

.app-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s, opacity 0.15s;
    width: 100%;
    max-width: 100%;
}
.app-btn:active { transform: scale(0.98); }
.app-btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}
.app-btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.app-btn-danger { background: var(--danger-color); color: white; }
.app-btn-block { display: flex; width: 100%; }

.app-login-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    max-width: 400px;
    margin: 0 auto;
}
.app-login-wrap .logo { font-size: 3rem; margin-bottom: 8px; }
.app-login-wrap h1 { font-size: 1.5rem; margin: 0 0 8px 0; color: var(--text-primary); }
.app-login-wrap .subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 32px; }
.app-login-wrap .form-group { width: 100%; margin-bottom: 16px; }
.app-login-wrap label { display: block; margin-bottom: 6px; font-size: 0.9rem; color: var(--text-secondary); }
.app-login-wrap input[type="email"],
.app-login-wrap input[type="password"],
.app-login-wrap input[type="text"],
.app-login-wrap input[type="number"],
.app-login-wrap input[type="date"],
.app-login-wrap input[type="time"],
.app-login-wrap select,
.app-login-wrap textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
}
.app-login-wrap input:focus, .app-login-wrap select:focus, .app-login-wrap textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}
.app-login-wrap .error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.app-login-wrap .link-web { margin-top: 24px; font-size: 0.85rem; }
.app-login-wrap .link-web a { color: var(--primary-light); text-decoration: none; }

/* Formularios app (mismos colores web) */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.9rem; color: var(--text-secondary); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1rem;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary-color); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.calendar-app .month-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 12px 0;
}
.calendar-app .month-nav a { color: var(--primary-light); text-decoration: none; padding: 8px 12px; font-weight: 600; }
.calendar-app .month-nav h2 { margin: 0; font-size: 1.1rem; }
.calendar-app .weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.calendar-app .days-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar-app .day-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    text-decoration: none;
    color: inherit;
}
.calendar-app .day-cell.empty { background: transparent; color: transparent; }
.calendar-app .day-cell.today {
    background: var(--primary-color);
    color: white;
    font-weight: 700;
}
.calendar-app .day-cell.has-services {
    background: rgba(99, 102, 241, 0.25);
    color: var(--primary-light);
    font-weight: 600;
}
.calendar-app .day-cell .count { display: block; font-size: 0.65rem; margin-top: 2px; }

.day-detail { margin-top: 16px; }
.day-detail h3 { font-size: 1rem; margin-bottom: 12px; color: var(--text-secondary); }
.servicio-item-app {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary-color);
}
.servicio-item-app .nombre { font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.servicio-item-app .empresa, .servicio-item-app .tipo { font-size: 0.85rem; color: var(--text-muted); }
.servicio-item-app .precio { font-weight: 700; color: var(--primary-light); margin-top: 6px; }
.servicio-item-app .acciones { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.servicio-item-app .acciones a, .servicio-item-app .acciones button {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
}
.servicio-item-app .acciones .btn-editar { background: var(--primary-color); color: white; }
.servicio-item-app .acciones .btn-eliminar { background: var(--danger-color); color: white; }

.resumen-mes-app {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    color: white;
    text-align: center;
}
.resumen-mes-app .label { font-size: 0.85rem; opacity: 0.9; }
.resumen-mes-app .total { font-size: 1.75rem; font-weight: 800; }

.menu-list-app a {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    color: var(--text-primary);
    text-decoration: none;
    border: 1px solid var(--border-color);
    transition: background 0.2s;
}
.menu-list-app a:active { background: var(--bg-hover); }
.menu-list-app a .menu-icon { font-size: 1.5rem; margin-right: 14px; width: 32px; text-align: center; }
.menu-list-app a .menu-label { flex: 1; font-weight: 500; }
.menu-list-app a .menu-arrow { color: var(--text-muted); font-size: 1.2rem; }
.menu-list-app .logout { margin-top: 24px; color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); }

.app-empty { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.app-empty .icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.6; }

.app-alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.9rem; }
.app-alert-warning {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid var(--warning-color);
    color: #fcd34d;
}
.app-alert-success { background: rgba(16, 185, 129, 0.2); border: 1px solid var(--secondary-color); color: #6ee7b7; }
.app-alert-info {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid var(--primary-color);
    color: var(--primary-light);
}
.app-alert-error { background: rgba(239, 68, 68, 0.2); border: 1px solid var(--danger-color); color: #fca5a5; }

/* Modal app */
.app-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}
.app-modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}
.app-modal-content h2 { margin: 0 0 16px 0; font-size: 1.2rem; color: var(--text-primary); }
.app-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    position: absolute;
    top: 16px;
    right: 16px;
}

/* Tabla simple */
.app-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.app-table th, .app-table td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--border-color); }
.app-table th { color: var(--text-muted); font-weight: 600; }
.app-table td { color: var(--text-primary); }

/* Tabs / secciones */
.app-tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.app-tabs a {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
}
.app-tabs a.active { background: var(--primary-color); color: white; }

