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

:root {
    --bg-color: #121212;
    --card-bg: rgba(30, 30, 30, 0.7);
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-color: #6c5ce7;
    --accent-hover: #5b4bc4;
    --danger-color: #ff7675;
    --success-color: #00b894;
    --glass-border: rgba(255, 255, 255, 0.1);
    --cat-ent: #fdcb6e;
    --cat-util: #74b9ff;
    --cat-soft: #a29bfe;
    --cat-other: #dfe6e9;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    background: linear-gradient(135deg, #121212 0%, #1a1a2e 100%);
    min-height: 100vh;
}

.glassmorphism {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.card {
    padding: 20px;
    margin-bottom: 20px;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-top: 10px;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    outline: none;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    transition: background-color 0.2s, transform 0.1s;
}

.icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.icon-btn:active {
    transform: translateY(0);
}

.add-btn {
    background-color: var(--accent-color);
    color: white;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.add-btn:active {
    transform: translateY(0);
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.dashboard h2 {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.toggle-switch {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 3px;
}

.toggle-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 5px 12px;
    border-radius: 17px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.toggle-btn.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.total-amount {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 5px;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.currency {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.currency-suffix {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: normal;
}

.yearly-estimate {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.ad-banner-placeholder {
    background: rgba(108, 92, 231, 0.15);
    border: 1px dashed var(--accent-color);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    width: 90%;
    max-width: 400px;
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-btn {
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.2rem;
    padding: 5px;
}

.close-btn:hover {
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

input,
select {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent-color);
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.price-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.price-input span {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background-color: var(--accent-color);
    color: white;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 10px;
    transition: background-color 0.2s;
}

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

.sub-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 12px;
    background: rgba(40, 40, 40, 0.6);
    border: 1px solid var(--glass-border);
    transition: transform 0.2s;
}

.sub-item:hover {
    transform: translateX(5px);
}

.sub-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sub-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    color: #333;
}

.sub-details h3 {
    font-size: 1rem;
    margin-bottom: 2px;
}

.sub-details p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.sub-meta {
    text-align: right;
}

.sub-price {
    font-weight: 600;
    font-size: 1.1rem;
}

.sub-next-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.sub-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}

.action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.action-btn.del:hover {
    color: var(--danger-color);
    border-color: rgba(255, 118, 117, 0.3);
}

.action-btn.complete {
    background: rgba(0, 184, 148, 0.1);
    border-color: rgba(0, 184, 148, 0.3);
    color: var(--success-color);
}

.action-btn.complete:hover {
    background: rgba(0, 184, 148, 0.2);
    color: #55efc4;
}

.action-btn.notify {
    background: rgba(108, 92, 231, 0.1);
    border-color: rgba(108, 92, 231, 0.3);
    color: var(--accent-color);
}

.action-btn.notify:hover {
    background: rgba(108, 92, 231, 0.2);
    color: #8c7ae6;
}

.warning-text {
    color: var(--danger-color);
    font-weight: 600;
}

.warning-card {
    border-color: rgba(255, 118, 117, 0.5);
    background: rgba(255, 118, 117, 0.05);
}

.settings-category-list {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 5px;
}

.category-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    margin-bottom: 8px;
}

.category-list-item span {
    font-size: 0.95rem;
}

.del-cat-btn {
    color: var(--danger-color);
    background: transparent;
    padding: 5px;
    font-size: 1rem;
}

.del-cat-btn:hover {
    color: #ff4757;
}

/* =========================================
   Responsive (Mobile) Layout Adjustments
   ========================================= */
@media (max-width: 480px) {
    .app-container {
        padding: 10px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .header-actions {
        gap: 8px;
    }

    .add-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .dashboard {
        padding: 15px;
    }

    .total-amount {
        font-size: 1.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Modal Adjustments */
    .modal {
        padding: 20px;
        margin: 10px;
        width: calc(100% - 20px);
    }

    .form-group input,
    .form-group select {
        font-size: 1rem;
        /* Prevent auto-zoom on iOS Safari */
    }

    /* Subscription Item Adjustments */
    .sub-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px;
        gap: 12px;
    }

    .sub-info {
        width: 100%;
        margin-right: 0;
    }

    .sub-name {
        font-size: 1.1rem;
        word-break: break-word;
        /* Prevent long names from breaking layout */
    }

    .sub-meta {
        flex-wrap: wrap;
    }

    .sub-amount-group {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
    }

    .sub-price {
        font-size: 1.2rem;
    }

    .sub-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 5px;
        border-top: 1px solid var(--glass-border);
        padding-top: 10px;
    }
}