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

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #10b981;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background: radial-gradient(circle at top left, #1e293b, #0f172a);
}

/* Glassmorphism Utilities */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

/* Login Page */
.login-container {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.login-box {
    width: 400px;
    padding: 2rem;
    text-align: center;
}

.login-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #818cf8, #34d399);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

/* Inputs & Buttons */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

input[type="text"],
input[type="password"],
select,
input[type="number"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    transition: all 0.3s ease;
}

/* Fix for Select Options in Dark Mode */
select option {
    background-color: var(--bg-dark);
    color: var(--text-main);
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.btn {
    width: 100%;
    padding: 0.8rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s, background 0.2s;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
}

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

.glass-card .btn.btn-secondary.active {
    background: rgba(99, 102, 241, 0.35);
    border-color: rgba(99, 102, 241, 0.65);
    color: #fff;
    box-shadow: 0 10px 22px rgba(99, 102, 241, 0.18);
}

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

.sidebar {
    width: 280px;
    padding: 2rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: width 0.25s ease, padding 0.25s ease;
}

.sidebar-toggle-edge {
    position: absolute;
    top: 22px;
    right: -14px;
    width: 28px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(30, 41, 59, 0.85);
    color: #cbd5e1;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(0,0,0,0.35);
    z-index: 5;
}

.sidebar-toggle-edge:hover {
    background: rgba(30, 41, 59, 0.95);
    color: #fff;
}

.sidebar.collapsed {
    width: 84px;
    padding: 1.25rem 0.75rem;
}

.sidebar.collapsed h2 {
    padding: 0 !important;
    margin-bottom: 1rem !important;
    font-size: 0;
    line-height: 0;
}

.sidebar.collapsed h2 i {
    font-size: 1.2rem;
    line-height: 1;
}

.sidebar.collapsed .btn,
.sidebar.collapsed .btn-secondary {
    padding: 0.7rem 0.6rem;
}

.sidebar.collapsed a.btn,
.sidebar.collapsed button.btn {
    font-size: 0;
}

.sidebar.collapsed a.btn i,
.sidebar.collapsed button.btn i {
    font-size: 1rem;
}

.sidebar.collapsed .btn i,
.sidebar.collapsed .btn-secondary i {
    margin: 0;
}

.sidebar.collapsed #categoryTabs {
    overflow: hidden;
}

.sidebar.collapsed .tab-btn {
    text-align: center;
    padding: 0.9rem 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
}

.sidebar.collapsed .tab-btn i {
    display: inline-block;
    margin-right: 0;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    border-color: rgba(79, 70, 229, 0.2);
    font-weight: 500;
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* Sidebar Tabs */
.tab-btn {
    text-align: left;
    padding: 1rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.tab-btn.active {
    background: linear-gradient(45deg, rgba(79, 70, 229, 0.2), rgba(16, 185, 129, 0.2));
    border-color: rgba(79, 70, 229, 0.3);
    color: #fff;
    font-weight: 500;
}

/* Cards */
.card-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-title {
    font-size: 1.8rem;
    font-weight: 600;
}

/* Forms in App */
.entry-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    align-items: end;
}

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

/* Export Button */
.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--secondary);
    width: auto;
    padding: 0.6rem 1.2rem;
}

.export-btn:hover {
    background: #059669;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: none;
}

.alert-error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #6ee7b7;
}

/* Loader */
.loader {
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
    display: none;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Table Styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.95rem;
    position: relative;
}

.data-table th {
    text-align: left;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-weight: 500;
}

.data-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--glass-border);
    vertical-align: middle;
    overflow: visible;
}

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

.data-table select.cell-input {
    position: relative;
    z-index: 30;
}

.data-table td select.cell-input[name="cost_currency"] {
    min-width: 84px;
    text-align: left;
    padding-right: 1.25rem;
}

.cell-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid var(--glass-border);
    padding: 0.55rem 0.65rem;
    color: white;
    border-radius: 6px;
    text-align: right;
}

.data-table .cell-input {
    min-width: 84px;
}

.data-table td:first-child {
    min-width: 260px;
}

.cell-input:focus {
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.8);
}

.action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    color: var(--text-muted);
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.row-hidden {
    background: rgba(0, 0, 0, 0.2) !important;
}

/* Sub Tabs Styling */
.sub-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.sub-tab-btn {
    padding: 0.6rem 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.sub-tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.sub-tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.sub-tabs::-webkit-scrollbar {
    height: 4px;
}

.sub-tabs::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.sub-tabs::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 2px;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}