/* assets/css/style.css */
/* Modern, high-aesthetic styling for SiPencair */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-app: #0f172a; /* Slate 900 */
    --bg-sidebar: #1e293b; /* Slate 800 */
    --bg-card: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc; /* Slate 50 */
    --text-secondary: #94a3b8; /* Slate 400 */
    --primary: #6366f1; /* Indigo 500 */
    --primary-hover: #4f46e5; /* Indigo 600 */
    --primary-light: rgba(99, 102, 241, 0.15);
    --accent: #0ea5e9; /* Sky 500 */
    --accent-light: rgba(14, 165, 233, 0.15);
    --success: #10b981; /* Emerald 500 */
    --success-light: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b; /* Amber 500 */
    --warning-light: rgba(245, 158, 11, 0.15);
    --danger: #ef4444; /* Red 500 */
    --danger-light: rgba(239, 68, 68, 0.15);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-sidebar);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Sidebar Layout */
aside {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1.25rem;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition);
}

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

.nav-links a svg {
    width: 20px;
    height: 20px;
    transition: var(--transition);
}

.nav-links a:hover svg, .nav-links li.active a svg {
    color: var(--primary);
    transform: translateX(2px);
}

/* Main Content Area */
main {
    flex: 1;
    margin-left: 280px;
    padding: 2.5rem;
    max-width: 1300px;
    width: calc(100% - 280px);
}

/* Top Header */
header.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.header-title h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-title p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.header-date {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Cards & Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(99, 102, 241, 0.3);
}

.stat-info p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

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

.stat-icon.primary { background-color: var(--primary-light); color: var(--primary); }
.stat-icon.accent { background-color: var(--accent-light); color: var(--accent); }
.stat-icon.success { background-color: var(--success-light); color: var(--success); }

/* Table Section */
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.actions-container {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Custom Input Styles */
.search-input {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    outline: none;
    font-family: inherit;
    transition: var(--transition);
}

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

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger-light);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

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

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

/* Data Table */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

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

.data-table th {
    padding: 1rem;
    background-color: rgba(15, 23, 42, 0.3);
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 1.15rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-primary);
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
}

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

/* Forms Styling */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    body {
        flex-direction: column;
    }
    aside {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1.5rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    main {
        margin-left: 0;
        width: 100%;
        padding: 1.5rem;
    }
}

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

.form-group.full-width {
    grid-column: 1 / -1;
}

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

.form-control {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: var(--transition);
    width: 100%;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.form-section-title {
    grid-column: 1 / -1;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

/* Items management table in form */
.items-manager {
    grid-column: 1 / -1;
    margin-top: 1rem;
}

.items-manager-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.items-manager-table th {
    padding: 0.75rem;
    text-align: left;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.items-manager-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* Tabs Navigation for Forms */
.form-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.25rem;
}

.form-tab {
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
}

.form-tab:hover, .form-tab.active {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.form-tab.active {
    border-bottom: 3px solid var(--primary);
    background-color: var(--primary-light);
    color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Detail Preview Styles */
.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 992px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.detail-info-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.detail-row {
    display: flex;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.detail-label {
    width: 200px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    flex-shrink: 0;
}

.detail-value {
    color: var(--text-primary);
    font-size: 0.875rem;
}

.calculations-box {
    background: rgba(99, 102, 241, 0.05);
    border: 1px dashed rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.875rem;
}

.calc-row.total {
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--success);
}

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

.print-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.print-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--primary);
}

.print-name h4 {
    font-size: 0.9rem;
    font-weight: 600;
}

.print-name p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h4 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Split Layout for Financial calculations */
.financial-split-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 1.5rem;
    align-items: start;
}

.financial-inputs-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.financial-preview-col {
    position: sticky;
    top: 2rem;
}

/* Financial Preview Card */
.preview-card {
    background: rgba(30, 41, 59, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.preview-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 10px 30px -5px rgba(99, 102, 241, 0.1);
}

.preview-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.preview-rows {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.preview-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    padding-bottom: 0.25rem;
}

.preview-row span:first-child {
    color: var(--text-secondary);
}

.preview-row span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

.preview-row.sub-total {
    border-top: 1px dashed var(--border-color);
    padding-top: 0.75rem;
    font-weight: 600;
}

.preview-row.sub-total span:first-child {
    color: var(--text-primary);
}

.preview-row.discount span:last-child {
    color: #f87171; /* red for deductions */
}

.preview-row.total-row {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 0.5rem;
    font-size: 1.15rem;
    font-weight: 800;
}

.preview-row.total-row span:first-child {
    color: var(--text-primary);
}

.preview-row.total-row span:last-child {
    color: var(--success);
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.preview-terbilang {
    margin-top: 1.25rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    padding: 0.85rem;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    line-height: 1.4;
}

.preview-terbilang strong {
    display: block;
    color: var(--accent);
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-terbilang span {
    font-style: italic;
    color: var(--text-primary);
    font-weight: 500;
}

@media (max-width: 992px) {
    .financial-split-grid {
        grid-template-columns: 1fr;
    }
    .financial-preview-col {
        position: static;
    }
}
