:root {
    /* Color Palette */
    --primary-color: #1193d4;
    --primary-hover: #0e7ab0;
    --secondary-color: #f8f9fa;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --success-color: #26bf84;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    
    /* Backgrounds */
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #1193d4 0%, #0c6fa1 100%);
    --gradient-success: linear-gradient(135deg, #26bf84 0%, #1f9d6b 100%);
    --gradient-bg: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-success: 0 4px 10px rgba(38, 191, 132, 0.4); 
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    background: var(--bg-body);
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    padding-bottom: 50px; /* Space for fixed footer nav */
    font-size: 16px;
    line-height: 1.5;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-dark);
    font-weight: 700;
    margin-top: 0;
}

/* Layout Containers */
.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

.main-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Card Containers (Forms, Results) */
.card-container {
    background: var(--bg-card);
    min-height: 100vh; /* Mobile full height */
    box-shadow: none;
}

/* Header Styles */
.app-header {
    background: var(--gradient-primary);
    color: white;
    padding: 1.5rem 1rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.app-header h1 {
    color: white;
    margin: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.app-header p {
    margin: 0.5rem 0 0;
    opacity: 0.9;
    font-size: 0.9rem;
    font-weight: 300;
}

/* Form Sections */
.form-body {
    padding: 1.5rem;
}

.form-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e5e7eb;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.form-section:hover {
    box-shadow: var(--shadow-md);
}

.form-section h3 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 0.75rem;
}

/* Form Controls */
.form-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-control, .form-select {
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.2s ease;
    width: 100%;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(17, 147, 212, 0.1);
    outline: none;
}

::placeholder {
    color: #9ca3af;
    opacity: 0.8;
}

/* Buttons - exclude DataTables buttons from custom styling */
.btn:not([class*="outline"]):not(.dt-button):not(.dt-buttons .btn) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    gap: 0.5rem;
}

/* Outline buttons - preserve their borders, but not DataTables buttons */
.btn[class*="outline"]:not(.dt-button):not(.dt-buttons .btn) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    cursor: pointer;
    gap: 0.5rem;
}

/* Button Groups - ensure proper display */
.btn-group {
    display: inline-flex !important;
    vertical-align: middle;
}

.btn-group > .btn {
    position: relative;
    flex: 1 1 auto;
}

/* Ensure btn-group-sm works correctly */
.btn-group-sm > .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.77rem;
}

.btn-primary {
    background: var(--primary-color);
    background: var(--gradient-primary); /* Use gradient */
    color: white;
    box-shadow: 0 4px 6px rgba(17, 147, 212, 0.2);
    border: none;
}

.btn-primary:hover {
    filter: brightness(1.1); /* Simple hover effect for gradients */
    transform: translateY(-1px);
    box-shadow: 0 6px 8px rgba(17, 147, 212, 0.3);
    color: white;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: var(--text-dark);
    border: 2px solid #e5e7eb;
}

.btn-secondary:hover {
    border-color: var(--text-muted);
    background: #f9fafb;
    color: var(--text-dark);
}

.btn-success {
    background: var(--success-color);
    background: var(--gradient-success); /* Premium gradient */
    color: white;
    box-shadow: var(--shadow-success);
    border: none;
}

.btn-success:hover {
    filter: brightness(1.08); /* Subtle brightening on hover */
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(38, 191, 132, 0.5);
    color: white;
}

.btn-success:active {
    transform: translateY(0);
}

/* Actions (Submit Button) */
.floating-actions {
    position: static;
    background: transparent;
    padding: 1.5rem 0.5rem;
    box-shadow: none;
    border-top: 1px solid #e5e7eb;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Progress Bar */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    z-index: 101;
    background: rgba(255,255,255,0.2);
}

.progress-bar {
    height: 100%;
    background: var(--success-color); /* Green for progress looks good */
    width: 0%;
    transition: width 0.3s ease;
}

/* Alerts */
.alert {
    border: none;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid transparent;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-color: var(--info-color);
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-color: var(--success-color);
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border-color: var(--danger-color);
}

/* Footers & Navigation */
.app-nav {
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    height: 70px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    transition: color 0.2s ease;
    font-size: 0.75rem;
    font-weight: 500;
}

.nav-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    transition: transform 0.2s ease;
}

.nav-item:hover, .nav-item.active {
    color: var(--primary-color);
}

.nav-item:hover svg, .nav-item.active svg {
    transform: translateY(-2px);
}

/* Utilities */
.text-center { text-align: center; }
.mb-3 { margin-bottom: 1rem; }
.d-none { display: none !important; }
.d-block { display: block; }
.w-100 { width: 100%; }
.mt-2 { margin-top: 0.5rem; }

/* Responsive display utilities */
@media (min-width: 768px) {
    .d-md-flex { display: flex !important; }
    .d-md-none { display: none !important; }
}
@media (max-width: 767.98px) {
    .d-md-flex { display: none !important; }
    .d-md-none { display: block !important; }
    
    .floating-actions {
        padding: 1.5rem 0;
    }

    .floating-actions .btn {
        padding: 1.25rem 1rem;
        font-size: 1.1rem;
        width: 100% !important;
    }
}

/* Conditional Fields Animation */
.conditional-field {
    display: none;
}
.conditional-field.show {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-blue {
    0% {
        box-shadow: 0 0 0 0 rgba(17, 147, 212, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(17, 147, 212, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(17, 147, 212, 0);
    }
}

.btn-pulse {
    animation: pulse-blue 2s infinite;
}

@keyframes pulse-whatsapp {
    0% {
        box-shadow: 0 0 0 0 rgba(38, 191, 132, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(38, 191, 132, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(38, 191, 132, 0);
    }
}

.btn-pulse-whatsapp {
    animation: pulse-whatsapp 2s infinite cubic-bezier(0.66, 0, 0, 1);
}

/* Desktop Styles */
@media (min-width: 768px) {
    body {
        background: var(--bg-body);
        padding: 2rem 0 120px 0;
    }

    .container {
        padding: 0 1rem;
    }

    .card-container {
        max-width: 900px;
        margin: 0 auto;
        border-radius: var(--radius-xl);
        min-height: auto;
        box-shadow: var(--shadow-lg);
        overflow: hidden;
    }
    
    .floating-actions {
        padding: 2rem;
        align-items: flex-end;
        flex-direction: row;
        justify-content: flex-end;
    }
    
    .floating-actions .btn {
        width: auto;
        min-width: 200px;
    }

    .app-header {
        border-radius: var(--radius-xl) var(--radius-xl) 0 0; /* Only top corners if inside card */
    }
}


