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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    transition: background-color var(--transition), color var(--transition);
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.nav-menu {
    width: 250px;
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    z-index: 10;
}

.nav-brand {
    padding: 2rem 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
}

.nav-links {
    flex: 1;
    padding: 1rem 0;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-links li a:hover, .nav-links li a.active {
    background-color: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    height: 70px;
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.views-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
}

.view {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.view.active-view {
    display: block;
}

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

/* Components */
.card {
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    border: 1px solid var(--border);
    transition: var(--transition);
}

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

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.stat-card:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon i {
    width: 24px;
    height: 24px;
}

.bg-primary-light { background-color: var(--primary-light); color: var(--primary); }
.bg-success-light { background-color: var(--success-light); color: var(--success); }
.bg-warning-light { background-color: var(--warning-light); color: var(--warning); }

/* Typography */
h1, h2, h3 { color: var(--text-main); font-weight: 600; }
.text-muted { color: var(--text-muted); }
.mb-4 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.text-sm { font-size: 0.875rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-size: 0.95rem;
}

.btn i { width: 18px; height: 18px; }

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-glow);
}

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

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

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

.btn-outline:hover {
    border-color: var(--text-muted);
    background-color: var(--surface-hover);
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-full);
}
.btn-icon:hover {
    background-color: var(--surface-hover);
    color: var(--primary);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

.input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--surface);
    color: var(--text-main);
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-row {
    display: flex;
    gap: 1rem;
}
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

/* Tables */
.table-responsive {
    overflow-x: auto;
}

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

.data-table th, .data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.data-table tr:hover td {
    background-color: var(--surface-hover);
}

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-content.large {
    max-width: 800px;
}

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

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.btn-close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
}
.btn-close:hover { color: var(--danger); }

/* Utilities & Specifics */
.add-item-row { display: flex; gap: 1rem; align-items: center; }
.quote-summary { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }
.summary-row { display: flex; justify-content: space-between; width: 200px; color: var(--text-muted); }
.summary-row.total { font-weight: 700; font-size: 1.25rem; color: var(--primary); border-top: 1px solid var(--border); padding-top: 0.5rem; }

/* Responsive Mobile */
@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    
    .nav-menu {
        width: 100%;
        height: auto;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--border);
        justify-content: space-around;
        padding: 0.5rem 0;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
        position: fixed;
        bottom: 0;
        z-index: 100;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }
    
    .nav-brand { display: none; }
    
    .nav-links {
        display: flex;
        flex-direction: row;
        padding: 0;
        width: 100%;
        justify-content: space-around;
    }
    
    .nav-links li a {
        display: flex;
        flex-direction: column;
        padding: 0.5rem;
        gap: 0.25rem;
        font-size: 0.75rem;
        border-left: none;
        border-bottom: 3px solid transparent;
        border-radius: var(--radius-sm);
    }
    
    .nav-links li a.active {
        border-bottom-color: var(--primary);
    }
    
    .nav-links li a span { display: block; }
    
    .main-content { margin-bottom: calc(70px + env(safe-area-inset-bottom)); } /* Space for bottom nav */
    
    .top-bar { padding: 0 1rem; }
    .views-container { padding: 1rem; padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
    .form-row { flex-direction: column; gap: 0; }
    .add-item-row { flex-direction: column; align-items: stretch; }
    .add-item-row .btn { margin-top: 0.5rem; }
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
}
@media (max-width: 768px) {
    .toast-container { bottom: 5rem; left: 1rem; right: 1rem; align-items: stretch; }
}
.toast {
    background-color: var(--surface);
    color: var(--text-main);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-left: 4px solid var(--primary);
    animation: slideInRight 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Dashboard Quote Cards */
.quote-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.quote-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary-light);
}
.quote-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.quote-card-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}
.quote-card-client {
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 500;
    margin-top: 0.25rem;
}
.quote-card-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.quote-card-total {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-main);
}
.quote-card-actions {
    display: flex;
    gap: 0.75rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}
.quote-card-actions .btn {
    flex: 1;
    justify-content: center;
}
.btn-whatsapp {
    background-color: #25D366;
    color: white;
}
.btn-whatsapp:hover {
    background-color: #128C7E;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.info { border-color: var(--primary); }
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
