/* CALM Microservicios - Estilos Minimalistas */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --error: #dc2626;
    --warning: #d97706;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.user-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Grid de Servicios */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Tarjetas de Servicio */
.service-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
}

.service-card:hover {
    box-shadow: var(--shadow-lg);
}

.service-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.service-icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.service-description {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* Formularios */
.service-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text);
}

input[type="text"],
input[type="number"],
select {
    padding: 0.625rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s;
    background: white;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Input de archivo personalizado */
.file-input-wrapper {
    position: relative;
    overflow: hidden;
}

input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-input-label {
    display: block;
    padding: 0.625rem;
    border: 2px dashed var(--border);
    border-radius: 6px;
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.file-input-wrapper:hover .file-input-label {
    border-color: var(--primary);
    color: var(--primary);
}

.file-input-wrapper.has-file .file-input-label {
    color: var(--text);
    border-color: var(--success);
    border-style: solid;
}

/* Checkbox */
.checkbox-group {
    flex-direction: row;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Ayuda de formulario */
.form-help {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Botones */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

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

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

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

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

.btn-download:hover {
    background: #15803d;
}

.btn-loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Resultados */
.result-container {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 6px;
    background: var(--bg);
}

.result-message {
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.result-message.success {
    color: var(--success);
}

.result-message.error {
    color: var(--error);
}

/* Panel de Estado */
.status-panel {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.status-panel h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.status-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-indicator.online {
    background: var(--success);
    animation: glow-success 2s ease-in-out infinite;
}

.status-indicator.offline {
    background: var(--error);
}

.status-indicator.loading {
    background: var(--warning);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes glow-success {
    0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.1); }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    h1 {
        font-size: 1.5rem;
    }
}

/* Login Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header {
    margin-bottom: 2rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    text-align: left;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.login-message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.login-message.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.login-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Single Service Container */
.single-service-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Admin Styles */
.admin-container {
    display: grid;
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.admin-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.admin-card h3 {
    margin-bottom: 1.5rem;
    color: var(--text);
    font-size: 1.25rem;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.admin-form input[type="text"],
.admin-form input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.admin-form input[type="text"]:focus,
.admin-form input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.username {
    font-weight: 600;
    color: var(--text);
}

.user-role {
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.user-role.admin {
    background: #dbeafe;
    color: #1e40af;
}

.user-role.user {
    background: #f3f4f6;
    color: #374151;
}

.user-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.protected {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.no-users {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.error {
    color: var(--error);
    text-align: center;
    padding: 1rem;
}

.success {
    color: var(--success);
}

.result-message {
    margin-top: 1rem;
}

.result-message .success {
    background: #dcfce7;
    color: #166534;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #bbf7d0;
}

.result-message .error {
    background: #fef2f2;
    color: #dc2626;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #fecaca;
}

.details {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.details p {
    margin: 0.25rem 0;
}

/* Service Actions */
.service-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}

/* Grid de Servicios */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Ayuda de formulario */
.form-help {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

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

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--bg);
    color: var(--text);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .login-card {
        padding: 2rem;
    }
    
    .user-item {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .user-actions {
        align-self: stretch;
        justify-content: flex-end;
    }
}

/* Animaciones */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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