/**
 * Savane Invoicer 3 - Main Stylesheet
 * Based on Giraphes Services Design System
 * Vanilla CSS - No framework
 */

/* ================================
   CSS VARIABLES & RESET
================================ */
:root {
    /* Primary Colors */
    --primary: #004aad;
    --primary-light: #1a5fb8;
    --primary-lighter: #e6effa;
    --primary-dark: #003580;

    /* Secondary Colors */
    --secondary: #f0edee;
    --secondary-light: #f7f5f6;
    --secondary-dark: #e0dcdd;

    /* Button Colors */
    --button-primary: #FFC800;
    --button-primary-hover: #e6b400;
    --button-secondary: #FF8427;
    --button-secondary-hover: #e6761f;

    /* Typography Colors */
    --heading-1: #004aad;
    --heading-2: #595959;
    --heading-3: #595959;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --text-light: #ffffff;

    /* Neutral Colors */
    --white: #ffffff;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;
    --black: #000000;

    /* Status Colors */
    --success: #4caf50;
    --success-light: #e8f5e9;
    --warning: #ff9800;
    --warning-light: #fff3e0;
    --error: #f44336;
    --error-light: #ffebee;
    --info: #2196f3;
    --info-light: #e3f2fd;

    /* Shadows */
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 2px 8px rgba(0, 74, 173, 0.08);
    --shadow-card-hover: 0 8px 16px rgba(0, 74, 173, 0.12);

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-pill: 9999px;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
}

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

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--gray-50);
    font-weight: 400;
}

/* ================================
   TYPOGRAPHY
================================ */
h1, .h1 {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--heading-1);
    margin-bottom: var(--space-lg);
    letter-spacing: -0.5px;
}

h2, .h2 {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--heading-2);
    margin-bottom: var(--space-md);
    letter-spacing: -0.3px;
}

h3, .h3 {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--heading-3);
    margin-bottom: var(--space-md);
}

h4, .h4 {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

h5, .h5 {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

h6, .h6 {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

p {
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
}

.text-small {
    font-size: 12px;
    line-height: 1.5;
}

.text-large {
    font-size: 16px;
    line-height: 1.6;
}

.text-muted {
    color: var(--text-muted);
}

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

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

.text-warning {
    color: var(--warning);
}

.text-error {
    color: var(--error);
}

code {
    font-family: 'Courier New', monospace;
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
}

/* ================================
   LAYOUT
================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* ================================
   HEADER
================================ */
.app-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: var(--space-xl) 0;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}


.app-header h1 {
    color: var(--white);
    margin-bottom: var(--space-md);
    font-size: 36px;
    position: relative;
    z-index: 1;
}

.app-header .subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    position: relative;
    z-index: 1;
}

/* ================================
   NAVIGATION
================================ */
.main-nav {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.nav-item-right {
    margin-left: auto;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: block;
    padding: var(--space-md) var(--space-lg);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: color var(--transition-fast);
    position: relative;
    border-radius: var(--radius-md);
}

.nav-link:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--primary);
    transition: width var(--transition-fast);
}

.nav-link:hover {
    color: var(--primary);
    background: var(--gray-50);
}

.nav-link:hover:after {
    width: 60%;
}

.nav-link.active {
    color: var(--primary);
    background: var(--primary-lighter);
    font-weight: 600;
}

.nav-link.active:after {
    width: 100%;
    left: 0;
    transform: translateX(0);
}

/* ================================
   MAIN CONTENT
================================ */
main {
    padding: var(--space-2xl) 0;
    min-height: 60vh;
}

/* ================================
   CARDS
================================ */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: box-shadow var(--transition-base);
    overflow: hidden;
    animation: fadeInUp 0.5s ease-out;
    margin-bottom: var(--space-lg);
}

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

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

.card-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.card-body {
    padding: var(--space-lg);
}

.card-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.card-minimal {
    box-shadow: var(--shadow-xs);
}

.card-minimal:hover {
    box-shadow: var(--shadow-sm);
}

/* ================================
   BUTTONS
================================ */
.btn, button:not(.unstyled) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
    position: relative;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    background: var(--button-primary);
    color: var(--text-primary);
}

.btn:hover, button:not(.unstyled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    background: var(--button-primary-hover);
}

.btn:active, button:not(.unstyled):active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: all 50ms;
    background: #d9a800;
}

.btn:focus, button:not(.unstyled):focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 74, 173, 0.2);
}

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

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

.btn-primary:active {
    background: #d9a800;
}

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

.btn-secondary:hover {
    background: var(--button-secondary-hover);
}

.btn-secondary:active {
    background: #d96d1a;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: none;
}

.btn-outline:hover {
    background: var(--primary-lighter);
    color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 74, 173, 0.2);
}

.btn-outline:active {
    background: var(--primary);
    color: var(--white);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-ghost {
    background: transparent;
    color: var(--text-primary);
    box-shadow: none;
}

.btn-ghost:hover {
    background: var(--gray-100);
    box-shadow: none;
}

.btn-ghost:active {
    background: var(--gray-200);
    box-shadow: none;
}

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

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn:disabled, button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    transform: none !important;
}

.btn:disabled:hover, button:disabled:hover {
    box-shadow: none;
    transform: none;
}

/* ================================
   FORMS
================================ */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label, label {
    display: block;
    margin-bottom: var(--space-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control, select, input[type="text"], input[type="number"], input[type="email"], textarea {
    width: 100%;
    padding: 10px 14px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    background: var(--white);
    transition: all var(--transition-base);
    color: var(--text-primary);
}

.form-control:focus, select:focus, input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 74, 173, 0.1);
}

.form-control:hover, select:hover, input:hover, textarea:hover {
    border-color: var(--gray-400);
}

.form-control:disabled, select:disabled, input:disabled, textarea:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
    opacity: 0.6;
}

.form-control-error {
    border-color: var(--error);
}

.form-control-error:focus {
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.1);
}

.form-hint, small {
    margin-top: var(--space-xs);
    font-size: 12px;
    color: var(--text-muted);
    display: block;
}

.form-error {
    margin-top: var(--space-xs);
    font-size: 12px;
    color: var(--error);
}

/* Select */
select.form-select, select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23595959' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

/* ================================
   MESSAGES / ALERTS
================================ */
.message, .alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    border-left: 4px solid;
    margin-bottom: var(--space-lg);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.message.success, .alert-success {
    background: var(--success-light);
    border-color: var(--success);
    color: var(--success);
}

.message.warning, .alert-warning {
    background: var(--warning-light);
    border-color: var(--warning);
    color: var(--warning);
}

.message.error, .alert-error {
    background: var(--error-light);
    border-color: var(--error);
    color: var(--error);
}

.message.info, .alert-info {
    background: var(--info-light);
    border-color: var(--info);
    color: var(--info);
}

.message h3 {
    color: inherit;
    margin-bottom: var(--space-sm);
    font-size: 16px;
}

.message ul {
    margin-left: 20px;
    margin-top: var(--space-sm);
}

.message ul li {
    margin-bottom: var(--space-xs);
}

.message strong {
    font-weight: 600;
}

/* ================================
   TABLES
================================ */
.table-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: var(--space-lg);
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}

table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--text-secondary);
    transition: background var(--transition-fast);
}

table tbody tr {
    transition: background var(--transition-fast);
}

table tbody tr:hover {
    background: var(--gray-50);
}

table tbody tr:last-child td {
    border-bottom: none;
}

td.number, td.text-right {
    text-align: right;
    font-family: 'Courier New', monospace;
}

/* ================================
   BADGES
================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: var(--primary-lighter);
    color: var(--primary);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-error {
    background: var(--error-light);
    color: var(--error);
}

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

/* ================================
   LOADING SPINNER
================================ */
.spinner, .loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

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

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner-lg {
    width: 32px;
    height: 32px;
    border-width: 4px;
}

/* ================================
   FOOTER
================================ */
footer {
    margin-top: var(--space-3xl);
    padding: var(--space-xl) 0;
    border-top: 1px solid var(--gray-200);
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    background: var(--white);
}

/* ================================
   UTILITY CLASSES
================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.flex {
    display: flex;
}

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

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.mt-1, .mt-sm { margin-top: var(--space-sm); }
.mt-2, .mt-md { margin-top: var(--space-md); }
.mt-3, .mt-lg { margin-top: var(--space-lg); }
.mb-1, .mb-sm { margin-bottom: var(--space-sm); }
.mb-2, .mb-md { margin-bottom: var(--space-md); }
.mb-3, .mb-lg { margin-bottom: var(--space-lg); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }

.text-center { text-align: center; }
.text-right { text-align: right; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.hidden {
    display: none;
}

/* ================================
   PAGE-SPECIFIC STYLES
================================ */

/* Welcome/Home Page */
.welcome-section {
    padding: 0;
}

.welcome-section .intro {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: var(--space-2xl);
    text-align: center;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-xl);
}

.feature-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-card);
    transition: all var(--transition-base);
    animation: fadeInUp 0.5s ease-out;
}

.feature-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

.feature-card h4 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-md);
}

/* Coming Soon Page */
.coming-soon {
    text-align: center;
    padding: var(--space-3xl) 0;
}

.placeholder-content {
    margin-top: var(--space-xl);
    text-align: left;
}

.placeholder-content ul {
    margin-left: 20px;
    margin-top: var(--space-md);
}

.placeholder-content ul li {
    margin-bottom: var(--space-sm);
    line-height: 1.6;
    color: var(--text-secondary);
}

.actions {
    margin-top: var(--space-xl);
}

/* Form Page Enhancements */
#invoice-form .form-group:last-child {
    margin-top: var(--space-xl);
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-list {
        flex-direction: column;
        gap: 0;
    }

    .nav-link {
        border-radius: 0;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .app-header h1 {
        font-size: 28px;
    }
}
