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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

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

.header-content {
    flex: 1;
}

.auth-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-btn, .logout-btn, .save-btn {
    padding: 10px 20px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.login-btn:hover, .logout-btn:hover, .save-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
    transform: translateY(-2px);
}

.save-btn {
    background: rgba(40, 167, 69, 0.8);
    border-color: rgba(40, 167, 69, 1);
}

.save-btn:hover {
    background: rgba(40, 167, 69, 1);
}

.save-btn-locked {
    background: rgba(108, 117, 125, 0.8);
    border-color: rgba(108, 117, 125, 1);
    opacity: 0.9;
}

.save-btn-locked:hover {
    background: rgba(108, 117, 125, 1);
    opacity: 1;
    cursor: pointer;
}

.email-display {
    font-size: 0.9rem;
    font-weight: 500;
    margin-right: 5px;
}

.plus-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    margin-right: 5px;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: #333;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-btn:hover {
    color: #667eea;
}

.auth-form-container {
    margin-top: 20px;
}

.auth-form h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.3rem;
}

.auth-form input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.auth-form input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.auth-submit-btn {
    width: 100%;
    padding: 12px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-submit-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.auth-error {
    margin-top: 10px;
    padding: 10px;
    background: #fee;
    color: #c33;
    border-radius: 6px;
    font-size: 0.9rem;
    display: none;
}

.auth-error.show {
    display: block;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.currency-toggle {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.currency-label {
    font-size: 1rem;
    font-weight: 500;
    margin-right: 5px;
}

.currency-btn {
    padding: 8px 20px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.currency-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.8);
}

.currency-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
    font-weight: 600;
}

.main-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

@media (max-width: 968px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-top {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .auth-section {
        width: 100%;
        justify-content: center;
    }
    
    .username-display {
        font-size: 0.8rem;
    }
    
    .login-btn, .logout-btn, .save-btn {
        font-size: 0.8rem;
        padding: 8px 16px;
    }
}

.subscriptions-section,
.summary-section {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.subscriptions-section h2,
.summary-section h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5rem;
}

.add-subscription-form {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 2px dashed #667eea;
}

.add-subscription-form h3 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 15px;
    font-weight: 600;
}

.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr auto;
    gap: 10px;
    align-items: center;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

#newCustomCategory {
    grid-column: 1 / -1;
}

.form-row input,
.form-row select {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-row input:focus,
.form-row select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.add-btn {
    padding: 12px 24px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.add-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.search-container {
    margin-bottom: 20px;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-input::placeholder {
    color: #999;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.filter-btn.active {
    background: #667eea;
    color: white;
}

.subscription-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px;
}

.subscription-item {
    display: flex;
    align-items: center;
    padding: 18px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
}

.subscription-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.subscription-item.selected {
    background: #e7f3ff;
    border-color: #667eea;
}

.subscription-item input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-right: 15px;
    cursor: pointer;
    accent-color: #667eea;
}

.subscription-info {
    flex: 1;
}

.subscription-right {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: 15px;
}

.subscription-name {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
    margin-bottom: 4px;
}

.subscription-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-container {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.category-display {
    font-size: 0.85rem;
    color: #666;
    text-transform: capitalize;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.category-display:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

.category-input {
    font-size: 0.85rem;
    padding: 2px 6px;
    border: 2px solid #667eea;
    border-radius: 4px;
    color: #333;
    text-transform: capitalize;
    font-family: inherit;
    min-width: 80px;
}

.category-input:focus {
    outline: none;
    border-color: #5568d3;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.category-edit-icon {
    font-size: 0.6rem;
    opacity: 0.5;
    vertical-align: middle;
    cursor: pointer;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.category-container:hover .category-edit-icon {
    opacity: 0.8;
}

.plan-selector {
    font-size: 0.8rem;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #333;
    cursor: pointer;
    margin-top: 4px;
    max-width: 200px;
    font-family: inherit;
}

.plan-selector:hover {
    border-color: #667eea;
}

.plan-selector:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.plan-display {
    font-size: 0.8rem;
    color: #666;
    margin-top: 4px;
    display: inline-block;
}

.subscription-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: #667eea;
    cursor: pointer;
    position: relative;
    min-width: 80px;
    text-align: right;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
}

.price-display {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.price-display:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

.edit-icon {
    font-size: 0.7rem;
    opacity: 0.5;
    vertical-align: middle;
    cursor: pointer;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.subscription-price:hover .edit-icon {
    opacity: 0.8;
}

.price-input {
    width: 90px;
    padding: 4px 8px;
    border: 2px solid #667eea;
    border-radius: 4px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #667eea;
    text-align: right;
    font-family: inherit;
}

.price-input:focus {
    outline: none;
    border-color: #5568d3;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.bulk-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.action-btn {
    padding: 12px 24px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.total-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 25px;
}

.total-label {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 10px;
}

.total-amount {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.annual-label {
    font-size: 0.9rem;
    opacity: 0.85;
    margin-top: 20px;
    margin-bottom: 8px;
}

.annual-amount {
    font-size: 1.8rem;
    font-weight: 600;
    opacity: 0.95;
}

.category-totals {
    margin-bottom: 25px;
}

.category-totals h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #555;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
}

.category-name {
    font-weight: 500;
    color: #333;
    text-transform: capitalize;
}

.category-amount {
    font-weight: 600;
    color: #667eea;
}

.selected-subscriptions-list {
    margin-bottom: 25px;
}

.selected-subscriptions-list h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #555;
}

#selectedSubscriptionsList {
    max-height: 200px;
    overflow-y: auto;
}

.selected-subscription-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.selected-subscription-name {
    color: #333;
    font-weight: 500;
}

.selected-subscription-price {
    font-weight: 600;
    color: #667eea;
}

.stats {
    display: flex;
    gap: 15px;
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

.export-section {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid #e9ecef;
}

.export-section h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #555;
}

.export-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.export-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.excel-btn {
    background: #28a745;
    color: white;
}

.excel-btn:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.pdf-btn {
    background: #dc3545;
    color: white;
}

.pdf-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

/* Upgrade Section Styles */
.upgrade-section {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid #e9ecef;
}

.upgrade-content {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 2px dashed #667eea;
}

.upgrade-content h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: #555;
}

.upgrade-message {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 15px;
}

.upgrade-btn {
    padding: 12px 24px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5568d3 0%, #654392 100%);
}

/* Scrollbar styling */
.subscription-list::-webkit-scrollbar {
    width: 8px;
}

.subscription-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.subscription-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.subscription-list::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

