:root {
    /* Color Palette - Dirock Nail Shop Style (Light, Minimalist, Elegant) */
    --bg-color: #f8f9fa; /* Very light gray for the main background to make white panels pop */
    --surface-color: #ffffff; /* White panels */
    --border-color: #e5e7eb; /* Soft gray borders */
    --text-primary: #111827; /* Near black */
    --text-secondary: #6b7280; /* Gray for labels and subtle text */
    --accent-color: #000000; /* Black for primary buttons (like Dirock) */
    --accent-hover: #333333; /* Dark gray for hover */
    --positive: #10b981;
    --negative: #ef4444;
    --font-main: 'Roboto', 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- PANELS (Replacing Glassmorphism with Clean Minimalist Cards) --- */
.glass-panel {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.hidden {
    display: none !important;
}

/* --- BUTTONS & INPUTS --- */
input, select {
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 4px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
    width: 100%;
}

input:focus, select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color);
}

button {
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 500;
    padding: 12px 24px;
    border-radius: 4px; /* Slightly rounded, like classic WooCommerce */
    border: none;
    transition: all 0.2s ease;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

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

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

.btn-secondary {
    background: #f3f4f6;
    color: var(--text-primary);
    border: 1px solid #d1d5db;
}

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

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
}

/* --- SCREENS --- */
.screen {
    min-height: 100vh;
    display: flex;
}

#login-screen {
    justify-content: center;
    align-items: center;
    background: #ffffff;
}

.login-container {
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

.brand-logo {
    max-width: 240px;
    margin-bottom: 2rem;
}

.login-container h2 {
    margin-bottom: 1.5rem;
    font-weight: 400;
    font-size: 1.5rem;
    color: var(--text-primary);
}

/* --- APP LAYOUT --- */
#app-screen {
    display: flex;
}

.sidebar {
    width: 260px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    border-radius: 0;
    box-shadow: none;
}

.sidebar-header {
    margin-bottom: 3rem;
    text-align: center;
}

.sidebar-logo {
    max-width: 180px;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-links li {
    margin-bottom: 0.2rem;
}

.nav-links a {
    display: block;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-links a:hover, .nav-links a.active {
    background: #f3f4f6;
    color: var(--text-primary);
}

.sidebar-footer {
    margin-top: auto;
}

.sidebar-footer button {
    width: 100%;
}

/* --- MAIN CONTENT --- */
.main-content {
    flex: 1;
    padding: 2.5rem 3rem;
    height: 100vh;
    overflow-y: auto;
}

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

.view-header h1 {
    font-weight: 400;
    font-size: 1.8rem;
    color: var(--text-primary);
}

.view-header p {
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

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

/* --- DASHBOARD CARDS --- */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.card {
    padding: 2rem;
    text-align: center;
}

.card h3 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.amount {
    font-size: 2.2rem;
    font-weight: 300;
}

.positive { color: var(--positive); }
.negative { color: var(--negative); }

/* --- EDITOR --- */
.editor-container {
    padding: 2.5rem;
}

.editor-header {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

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

th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    background: #f9fafb;
}

td input {
    background: #ffffff;
    border: 1px solid transparent;
}

td input:focus {
    border: 1px solid var(--border-color);
    box-shadow: none;
}

.editor-totals {
    margin-top: 2rem;
    width: 320px;
    margin-left: auto;
    background: #f9fafb;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.totals-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    align-items: center;
    font-size: 0.95rem;
}

.totals-row label {
    color: var(--text-secondary);
}

.grand-total {
    border-top: 2px solid var(--border-color);
    padding-top: 1rem;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-primary);
}

#save-doc-btn {
    width: 100%;
    margin-top: 1.5rem;
}

/* --- AUTOCOMPLETE --- */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    z-index: 10;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.autocomplete-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.autocomplete-item:hover {
    background: #f3f4f6;
}

.search-bar {
    margin-bottom: 1.5rem;
}

/* --- GOOGLE FONTS --- */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

/* --- RESPONSIVE DESIGN (MOBILE) --- */
@media screen and (max-width: 768px) {
    #app-screen {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        height: auto;
    }

    .sidebar-header {
        margin-bottom: 1rem;
    }

    .sidebar-logo {
        max-width: 120px;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .nav-links li {
        margin-bottom: 0;
        flex: 1 1 45%;
    }

    .nav-links a {
        text-align: center;
        padding: 8px;
        font-size: 0.85rem;
    }

    .sidebar-footer {
        margin-top: 1rem;
    }

    .main-content {
        padding: 1rem;
        height: auto;
        overflow-y: visible;
    }

    .dashboard-cards {
        grid-template-columns: 1fr;
    }

    .editor-container {
        padding: 1rem;
    }

    .editor-header {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .editor-totals {
        width: 100%;
    }

    .editor-items {
        overflow-x: auto;
    }

    /* Make tables responsive */
    .glass-panel {
        overflow-x: auto;
    }

    table {
        min-width: 600px;
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .login-container {
        padding: 1.5rem;
        margin: 1rem;
    }
}

/* --- PRINT STYLES --- */
#print-area { display: none; }

@media print {
    body * { visibility: hidden; }
    #print-area, #print-area * { visibility: visible; }
    #print-area {
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 20px;
        background: white;
    }
    .print-header { text-align: center; margin-bottom: 2rem; border-bottom: 2px solid #000; padding-bottom: 1rem; }
    .print-header img { max-width: 200px; }
    .print-meta { display: flex; justify-content: space-between; margin-bottom: 2rem; }
    .print-table { width: 100%; border-collapse: collapse; margin-bottom: 2rem; }
    .print-table th, .print-table td { border: 1px solid #000; padding: 10px; text-align: left; }
    .print-totals { width: 300px; margin-left: auto; border: 1px solid #000; padding: 1rem; }
    .print-totals div { display: flex; justify-content: space-between; margin-bottom: 0.5rem; }
}
