/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@import url('https://rsms.me/inter/inter.css');

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #1a202c;
    line-height: 1.6;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
}

.login-box {
    background: white;
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(10px);
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #718096;
    font-size: 0.95rem;
    font-weight: 500;
}

.login-form {
    display: flex;
    flex-direction: column;
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.nav-brand {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.5rem;
}

.nav-menu a {
    color: #cbd5e0;
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
}

/* App Layout */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #f7fafc;
}

.main-content {
    flex: 1;
    padding: 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.page-header {
    margin-bottom: 2.5rem;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #1a202c 0%, #667eea 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: #718096;
    font-size: 1.05rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.6rem;
    font-weight: 600;
    color: #2d3748;
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.85rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background-color: #f7fafc;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background-color: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    align-items: flex-end;
}

/* Cards */
.card {
    background: white;
    border-radius: 1rem;
    padding: 1.75rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.card-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #1a202c;
}

.card-label {
    color: #718096;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.card-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: #667eea;
}

/* Summary Cards with Gradient Backgrounds */
.summary-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    position: relative;
    overflow: hidden;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.1) 0%, transparent 70%);
}

.summary-card:nth-child(1) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.summary-card:nth-child(1) .card-label,
.summary-card:nth-child(1) .card-value {
    color: white;
    opacity: 0.95;
}

.summary-card:nth-child(2) {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.summary-card:nth-child(2) .card-label,
.summary-card:nth-child(2) .card-value {
    color: white;
    opacity: 0.95;
}

.summary-card:nth-child(3) {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.summary-card:nth-child(3) .card-label,
.summary-card:nth-child(3) .card-value {
    color: white;
    opacity: 0.95;
}

.summary-card:nth-child(4) {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

.summary-card:nth-child(4) .card-label,
.summary-card:nth-child(4) .card-value {
    color: white;
    opacity: 0.95;
}

.full-width {
    grid-column: 1 / -1;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.6);
}

.btn-success {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(67, 233, 123, 0.4);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 233, 123, 0.6);
}

.btn-danger {
    background: linear-gradient(135deg, #f5576c 0%, #fa0641 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.6);
}

.btn-block {
    width: 100%;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-bottom: 2px solid #e2e8f0;
}

table th {
    padding: 1.25rem 1rem;
    text-align: left;
    font-weight: 700;
    color: #2d3748;
    font-size: 0.95rem;
}

table td {
    padding: 1rem;
    border-bottom: 1px solid #edf2f7;
    color: #4a5568;
}

table tbody tr {
    transition: all 0.2s ease;
}

table tbody tr:hover {
    background-color: #f7fafc;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
    border-left: 4px solid;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-left-color: #43e97b;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border-left-color: #f5576c;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
    border-left-color: #4facfe;
}

/* Budget Progress */
.budget-progress {
    margin-top: 1.5rem;
}

.progress-bar {
    background-color: #e2e8f0;
    border-radius: 1rem;
    height: 28px;
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    padding-right: 1rem;
    transition: width 0.5s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.progress-text {
    text-align: right;
    font-weight: 700;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Lists */
.item-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.item-card {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    padding: 1.25rem;
    border-radius: 0.75rem;
    border-left: 4px solid;
    border-left-color: #667eea;
    transition: all 0.3s ease;
}

.item-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.item-name {
    font-weight: 700;
    color: #1a202c;
    font-size: 1.05rem;
}

.item-meta {
    font-size: 0.9rem;
    color: #718096;
    margin-top: 0.35rem;
}

/* Charts */
canvas {
    max-height: 400px;
    margin-top: 1rem;
}

/* Search Bar */
.search-bar {
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 0.25rem;
    font-size: 1rem;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 0.25rem 0.25rem;
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
    z-index: 1000;
    display: none;
}

.autocomplete-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.autocomplete-item:hover {
    background-color: #f8f9fa;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 1.25rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 1rem;
}

.modal-header h2 {
    color: #1a202c;
    margin: 0;
    font-size: 1.75rem;
}

.close {
    font-size: 2rem;
    font-weight: 300;
    color: #a0aec0;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #2d3748;
}

.modal-body {
    margin-bottom: 1.5rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background-color: white;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: all 0.3s;
}

.pagination button.active,
.pagination button:hover {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

/* Grid Items */
.grid-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
}

.grid-item {
    background: white;
    padding: 1.5rem 1.25rem;
    border-radius: 0.85rem;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.grid-item:hover {
    border-color: #667eea;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.2);
    transform: translateY(-4px);
}

.grid-item-name {
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
}

.grid-item-category {
    font-size: 0.85rem;
    color: #a0aec0;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.grid-item-info {
    font-size: 0.9rem;
    color: #4a5568;
    line-height: 1.6;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.export-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Filter Controls */
.filter-controls {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.filter-controls select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 0.25rem;
}

/* Items Section */
.items-section {
    margin: 2rem 0;
}

.items-section h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.add-item-row {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 0.25rem;
    margin-top: 1rem;
}

.items-table td {
    text-align: right;
}

.items-table td:first-child {
    text-align: left;
}

/* Quick Action */
.quick-action {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1.25rem;
        padding: 1.25rem 1.5rem;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .nav-menu a {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .main-content {
        padding: 1.5rem;
    }

    .page-header h1 {
        font-size: 1.75rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .form-grid,
    .form-row {
        grid-template-columns: 1fr;
    }

    .grid-items {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .card {
        padding: 1.25rem;
    }

    table {
        font-size: 0.9rem;
    }

    table th,
    table td {
        padding: 0.75rem 0.5rem;
    }

    .modal-content {
        max-width: 95%;
        padding: 1.5rem;
    }

    .btn {
        padding: 0.65rem 1.25rem;
        font-size: 0.9rem;
    }

    .login-box {
        padding: 2rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 1rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .dashboard-grid {
        gap: 1rem;
    }

    .card {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    .card-title {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    .card-value {
        font-size: 1.75rem;
    }

    .btn-block {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .search-bar,
    .btn,
    .pagination,
    .quick-action,
    .action-buttons {
        display: none;
    }

    body {
        background: white;
    }

    .card {
        box-shadow: none;
        border: 1px solid #e2e8f0;
        page-break-inside: avoid;
    }

    .main-content {
        padding: 2rem;
    }
}
