/* KloudTech Budget System 2025 - Dashboard Style with Yellow & Gray */
/* Inspired by modern dashboard design */

/* Design System */
:root {
    /* Yellow Color Palette */
    --yellow-50: #fffbeb;
    --yellow-100: #fef3c7;
    --yellow-200: #fde68a;
    --yellow-300: #fcd34d;
    --yellow-400: #fbbf24;
    --yellow-500: #f59e0b;
    --yellow-600: #d97706;
    --yellow-700: #b45309;
    --yellow-800: #92400e;
    --yellow-900: #78350f;
    
    /* Gray Color Palette */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Status Colors */
    --success-500: #10b981;
    --success-600: #059669;
    --danger-500: #ef4444;
    --danger-600: #dc2626;
    --info-500: #3b82f6;
    --info-600: #2563eb;
    
    /* Gradients */
    --gradient-yellow: linear-gradient(135deg, var(--yellow-400) 0%, var(--yellow-600) 100%);
    --gradient-gray: linear-gradient(135deg, var(--gray-600) 0%, var(--gray-800) 100%);
    --gradient-success: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
    --gradient-header: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-900) 100%);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
}

/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-100);
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
}

/* Header Section */
.header-section {
    background: var(--gradient-header);
    color: white;
    padding: var(--space-8) var(--space-6);
    text-align: center;
    margin-bottom: var(--space-8);
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: var(--space-3);
    letter-spacing: -0.025em;
}

.subtitle {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--gray-300);
    margin-bottom: var(--space-6);
}

/* Save Status */
.save-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.save-status.success {
    background: var(--gradient-success);
    border-color: var(--success-600);
}

.save-status.error {
    background: var(--gradient-danger);
    border-color: var(--danger-600);
}

/* Main Content */
.main-content {
    padding: 0 var(--space-6) var(--space-8);
}

/* Budget Settings Grid */
.budget-settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.setting-group {
    background: white;
    padding: var(--space-6);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
}

.setting-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--space-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.setting-group input {
    width: 100%;
    padding: var(--space-4) var(--space-5);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-xl);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    background: var(--gray-50);
    transition: all 0.3s ease;
    font-variant-numeric: tabular-nums;
}

.setting-group select {
    width: 100%;
    padding: var(--space-4) var(--space-5);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-xl);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    background: var(--gray-50);
    transition: all 0.3s ease;
    cursor: pointer;
    /* Custom dropdown arrow positioning */
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right var(--space-8) center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: var(--space-16);
}

.setting-group input:focus,
.setting-group select:focus {
    outline: none;
    border-color: var(--yellow-500);
    background: white;
    box-shadow: 0 0 0 3px var(--yellow-100);
}

.currency-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-symbol {
    position: absolute;
    left: var(--space-5);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-600);
    z-index: 10;
    pointer-events: none;
}

.currency-input-group input {
    padding-left: var(--space-16);
}

.exchange-rate-group {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.exchange-rate-group input {
    flex: 1;
    background: var(--gray-100);
    cursor: not-allowed;
}

.btn-refresh {
    padding: var(--space-3);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    background: var(--gray-50);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 48px;
}

.btn-refresh:hover {
    background: var(--yellow-500);
    border-color: var(--yellow-500);
    transform: rotate(90deg);
}

.rate-status {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--success-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.rate-status.loading {
    color: var(--yellow-600);
}

.rate-status.error {
    color: var(--danger-600);
}

/* Overview Grid */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.overview-card {
    padding: var(--space-8);
    border-radius: var(--radius-2xl);
    color: white;
    text-align: center;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.overview-card:hover {
    transform: translateY(-4px);
}

.overview-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(30px, -30px);
}

.overview-card.total-budget {
    background: var(--gradient-yellow);
}

.overview-card.total-spent {
    background: var(--gradient-gray);
}

.overview-card.remaining {
    background: var(--gradient-success);
}

.overview-card.percent-used {
    background: var(--gradient-success);
}

.overview-card h3 {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-4);
    opacity: 0.9;
}

.overview-card p {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    font-variant-numeric: tabular-nums;
    margin-bottom: var(--space-2);
}

.overview-card .subtitle-text {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.8;
    margin: 0;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Category Content */
.category-content {
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-8);
    border: 1px solid var(--gray-200);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-8);
    gap: var(--space-4);
}

.category-controls {
    background: white;
    padding: 0.125rem;
}

.category-controls label {
    display: block;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--space-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.category-controls select {
    width: 100%;
    padding: var(--space-4) var(--space-5);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-xl);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    background: var(--gray-50);
    transition: all 0.3s ease;
    cursor: pointer;
    /* Custom dropdown arrow positioning */
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right var(--space-8) center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: var(--space-16);
}

.category-controls select:focus {
    outline: none;
    border-color: var(--yellow-500);
    background: white;
    box-shadow: 0 0 0 3px var(--yellow-100);
}

/* Category Actions */
.category-actions {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border: 2px solid transparent;
    border-radius: var(--radius-xl);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.5s;
    z-index: 1;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--gradient-yellow);
    color: white;
    box-shadow: var(--shadow-lg);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.btn-danger {
    background: white;
    color: var(--danger-600);
    border-color: var(--gray-300);
}

.btn-danger:hover {
    background: var(--danger-500);
    color: white;
    border-color: var(--danger-500);
    transform: translateY(-1px);
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: 0.75rem;
}

/* Remove the separate Add Category and Edit Category button styles since they now use btn-primary */

/* Table */
.table-container {
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-6);
    border: 1px solid var(--gray-200);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-variant-numeric: tabular-nums;
}

th, td {
    padding: var(--space-4) var(--space-5);
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

th {
    background: var(--gray-50);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 2px solid var(--gray-200);
}

tbody tr {
    transition: all 0.2s ease;
}

tbody tr:hover {
    background: var(--yellow-50);
}

tbody tr:last-child td {
    border-bottom: none;
}

td input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    background: transparent;
    transition: all 0.2s ease;
    font-variant-numeric: tabular-nums;
}

td input:hover {
    background: white;
    border-color: var(--gray-200);
}

td input:focus {
    outline: none;
    background: white;
    border-color: var(--yellow-500);
    box-shadow: 0 0 0 3px var(--yellow-100);
}

.total-cost {
    font-weight: 700;
    color: var(--success-600);
    font-size: 1rem;
}

/* Category Summary */
.category-summary {
    background: var(--gradient-yellow);
    color: white;
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    text-align: center;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.category-summary::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(20px, -20px);
}

.category-summary h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Modal Styles for Add/Edit Category */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: var(--gray-800);
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
    padding: var(--space-2);
    line-height: 1;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.modal-body {
    padding: var(--space-6);
}

.form-group {
    margin-bottom: var(--space-6);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-3);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input {
    width: 100%;
    padding: var(--space-4) var(--space-5);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-xl);
    font-size: 1rem;
    font-weight: 500;
    background: var(--gray-50);
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--yellow-500);
    background: white;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1);
}

/* Icon Grid */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: var(--space-3);
    padding: var(--space-4) 0;
}

.icon-option {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.icon-option:hover {
    border-color: var(--yellow-500);
    background: var(--yellow-50);
    transform: scale(1.05);
}

.icon-option.selected {
    border-color: var(--yellow-500);
    background: var(--yellow-500);
    color: white;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

.modal-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--gray-200);
}

.modal-actions .btn {
    padding: var(--space-3) var(--space-6);
    border: 2px solid transparent;
    border-radius: var(--radius-xl);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.modal-actions .btn-primary {
    background: var(--gradient-yellow);
    color: white;
    box-shadow: var(--shadow-md);
}

.modal-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.modal-actions .btn-secondary {
    background: white;
    color: var(--gray-600);
    border-color: var(--gray-300);
}

.modal-actions .btn-secondary:hover {
    background: var(--gray-50);
    color: var(--gray-800);
    border-color: var(--gray-400);
}

/* Delete Category Button */
.modal-actions .btn-danger {
    background: white;
    color: var(--danger-600);
    border-color: var(--danger-300);
}

.modal-actions .btn-danger:hover {
    background: var(--danger-500);
    color: white;
    border-color: var(--danger-500);
}

/* Notifications */
.notification {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    padding: var(--space-4) var(--space-6);
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    font-size: 0.875rem;
    font-weight: 500;
    border-left: 4px solid var(--yellow-500);
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification.success {
    border-left-color: var(--success-500);
    color: var(--success-700);
}

.notification.error {
    border-left-color: var(--danger-500);
    color: var(--danger-700);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Empty State Styling */
.empty-state-row {
    background: var(--gray-50) !important;
}

.empty-state {
    text-align: center !important;
    padding: var(--space-16) var(--space-8) !important;
    border: 2px dashed var(--gray-300) !important;
    border-radius: var(--radius-lg);
    background: white !important;
}

.empty-state-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    max-width: 400px;
    margin: 0 auto;
}

.empty-state-icon {
    font-size: 3rem;
    opacity: 0.6;
    margin-bottom: var(--space-2);
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-700);
    margin: 0;
}

.empty-state-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 0;
    line-height: 1.5;
}

.empty-state-btn {
    margin-top: var(--space-2);
}

/* Placeholder styling for inputs */
input::placeholder {
    color: var(--gray-400);
    font-style: italic;
}

/* Category Header with Edit Button - Remove this section since layout changed */

/* Responsive Design */
@media (max-width: 768px) {
    .header-section {
        padding: var(--space-6) var(--space-4);
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .main-content {
        padding: 0 var(--space-4) var(--space-6);
    }
    
    .overview-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
    
    .budget-settings {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
    
    .category-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-4);
    }
    
    .category-actions {
        justify-content: center;
        flex-wrap: wrap;
        gap: var(--space-2);
    }
    
    .category-actions .btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    th, td {
        padding: var(--space-3);
        font-size: 0.875rem;
    }
    
    .overview-card p {
        font-size: 2rem;
    }
    
    /* Modal responsive adjustments */
    .modal-content {
        width: 95%;
        margin: var(--space-4);
    }
    
    .icon-grid {
        grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
        gap: var(--space-2);
    }
    
    .icon-option {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .btn-add-category,
    .btn-edit-category {
        font-size: 0.75rem;
        padding: var(--space-2) var(--space-3);
    }
}