/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a202c;
    min-height: 100vh;
    line-height: 1.6;
    color: #e0e6ed;
}

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

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #e0e6ed;
}

.header h1 i {
    margin-right: 15px;
    color: #667eea;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.8;
    font-weight: 300;
}

/* Card Styles */
.card {
    background: #2d3748;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 1px solid #4a5568;
}

.card h2 {
    color: #e0e6ed;
    margin-bottom: 20px;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
}

.card h2 i {
    margin-right: 10px;
    color: #667eea;
}

/* Form Styles */
.transaction-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #a0aec0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.form-group input, .form-group textarea {
    padding: 12px 15px;
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255,255,255,0.05);
    color: #e0e6ed;
    backdrop-filter: blur(10px);
}

.form-group input::placeholder, .form-group textarea::placeholder {
    color: rgba(224, 230, 237, 0.5);
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2), 0 0 20px rgba(102, 126, 234, 0.1);
    background: rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

.form-group input:disabled {
    background-color: rgba(255,255,255,0.02);
    color: rgba(224, 230, 237, 0.5);
    cursor: not-allowed;
    border-color: rgba(255,255,255,0.05);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

.helper-text {
    margin-top: 5px;
    font-size: 0.875rem;
    color: #666;
}

.helper-text.warning {
    color: #ffc107;
    font-weight: 500;
}

.helper-text.error {
    color: #dc3545;
    font-weight: 500;
}

/* Profit Display */
.profit-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.profit-label {
    font-weight: 600;
    color: #555;
}

.profit-amount {
    font-size: 1.2rem;
    font-weight: 700;
    color: #28a745;
}

.profit-amount.negative {
    color: #dc3545;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn i {
    margin-right: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: rgba(108, 117, 125, 0.5);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-toggle {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.btn-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(23, 162, 184, 0.4);
}

.btn-toggle.active {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.btn-toggle.active i {
    transform: rotate(180deg);
}

.summary-toggle-section {
    text-align: center;
    margin-bottom: 20px;
}

.summary-section {
    overflow: hidden;
    transition: all 0.4s ease;
}

.summary-section.slide-in {
    animation: summarySlideDown 0.4s ease-out;
}

.summary-section.slide-out {
    animation: summarySlideUp 0.4s ease-out;
}

@keyframes summarySlideDown {
    from { max-height: 0; opacity: 0; }
    to { max-height: 500px; opacity: 1; }
}

@keyframes summarySlideUp {
    from { max-height: 500px; opacity: 1; }
    to { max-height: 0; opacity: 0; }
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.875rem;
}

/* Summary Grid */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.summary-item {
    display: flex;
    align-items: center;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.summary-item.income {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.summary-item.expense {
    background: linear-gradient(135deg, #dc3545, #fd7e14);
    color: white;
}

.summary-item.profit {
    background: linear-gradient(135deg, #17a2b8, #6610f2);
    color: white;
}

.summary-icon {
    font-size: 2rem;
    margin-right: 15px;
    opacity: 0.8;
}

.summary-content {
    display: flex;
    flex-direction: column;
}

.summary-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.summary-value {
    font-size: 1.4rem;
    font-weight: 700;
}

/* Controls Section */
.controls-section {
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(255,255,255,0.02);
    border-radius: 15px;
    border: 1px solid rgba(255,255,255,0.05);
}

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

.search-box {
    position: relative;
    max-width: 400px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(224, 230, 237, 0.5);
    z-index: 1;
}

.search-box input {
    width: 100%;
    padding-left: 45px;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 25px;
    transition: all 0.3s ease;
}

.search-box {
    position: relative;
    max-width: 100%;
    margin-bottom: 20px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    z-index: 1;
}

.search-box input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    background: #4a5568;
    border: 1px solid #718096;
    border-radius: 8px;
    color: #e0e6ed;
    transition: all 0.3s ease;
}

.search-box input:focus {
    border-color: #667eea;
    outline: none;
    background: #4a5568;
}

.filter-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: end;
}

.filter-group, .sort-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group {
    position: relative;
}

.filter-group input, .sort-group select {
    padding: 10px 15px;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: #e0e6ed;
    transition: all 0.3s ease;
}

.filter-group input:focus, .sort-group select:focus {
    border-color: #667eea;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.2);
    background: rgba(255,255,255,0.08);
}

.sort-group select option {
    background: #1a202c;
    color: #e0e6ed;
}

.btn-clear-filter {
    position: absolute;
    right: 10px;
    top: 32px;
    background: rgba(220, 53, 69, 0.8);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-clear-filter:hover {
    background: rgba(220, 53, 69, 1);
    transform: scale(1.1);
}

/* Transaction History */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.transaction-list {
    /* Remove scrolling - pagination handles this */
}

.transaction-item {
    display: grid;
    grid-template-columns: 100px 1fr auto auto;
    gap: 15px;
    align-items: center;
    padding: 15px;
    border: 1px solid #4a5568;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #2d3748;
    transition: all 0.3s ease;
}

.transaction-item:hover {
    background: #374151;
    border-color: #667eea;
}

.transaction-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-edit, .btn-delete {
    padding: 6px 8px;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit {
    background: #3182ce;
    color: white;
}

.btn-edit:hover {
    background: #2c5282;
}

.btn-delete {
    background: #e53e3e;
    color: white;
}

.btn-delete:hover {
    background: #c53030;
}

.btn-edit:disabled, .btn-delete:disabled {
    background: #4a5568;
    color: #a0aec0;
    cursor: not-allowed;
}

.transaction-time-left {
    font-size: 0.75rem;
    color: #a0aec0;
    font-style: italic;
}

.transaction-date {
    font-weight: 600;
    color: #667eea;
    min-width: 100px;
}

.transaction-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.transaction-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.transaction-note {
    font-size: 0.9rem;
    color: rgba(224, 230, 237, 0.7);
    font-style: italic;
    margin-top: 5px;
    line-height: 1.4;
}

.transaction-amounts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.transaction-income, .transaction-expense {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    min-width: 100px;
}

.transaction-income {
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.transaction-expense {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.transaction-income .label {
    color: #28a745;
    font-size: 0.875rem;
    margin-bottom: 3px;
}

.transaction-expense .label {
    color: #dc3545;
    font-size: 0.875rem;
    margin-bottom: 3px;
}

.transaction-income .amount,
.transaction-expense .amount {
    font-weight: 600;
    font-size: 1.1rem;
}

.transaction-profit {
    font-weight: 700;
    min-width: 120px;
    text-align: right;
}

.transaction-profit.positive {
    color: #28a745;
}

.transaction-profit.negative {
    color: #ff6b6b;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.pagination button {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.pagination button:disabled {
    background: rgba(108, 117, 125, 0.3);
    cursor: not-allowed;
    opacity: 0.5;
}

#pageInfo {
    color: rgba(224, 230, 237, 0.8);
    font-weight: 500;
}

.empty-state {
    text-align: center;
    padding: 60px;
    color: rgba(224, 230, 237, 0.6);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
    background: linear-gradient(135deg, #667eea, #764ba2);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 0;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    animation: modalFadeIn 0.3s ease-out;
}

.modal.closing {
    animation: modalFadeOut 0.3s ease-out forwards;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.modal-content {
    background-color: #2d3748;
    margin: 15% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    border: 1px solid #4a5568;
    color: #e0e6ed;
    animation: modalSlideIn 0.3s ease-out;
}

.modal.closing .modal-content {
    animation: modalSlideOut 0.3s ease-out forwards;
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes modalSlideOut {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-50px); opacity: 0; }
}

.modal-content h3 {
    margin-bottom: 15px;
    color: #333;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 20px;
    top: 15px;
    cursor: pointer;
}

.close:hover {
    color: #333;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .filter-controls {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .search-box {
        max-width: 100%;
    }

    .transaction-item {
        grid-template-columns: 1fr;
        gap: 15px;
        text-align: center;
    }

    .transaction-details {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .transaction-amounts {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .transaction-date {
        font-size: 1.1rem;
        font-weight: 700;
        color: #667eea;
        text-align: center;
        padding: 10px;
        background: rgba(102, 126, 234, 0.1);
        border-radius: 8px;
    }

    .profit-display {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .modal-content {
        margin: 30% auto;
        width: 95%;
    }

    .pagination {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }

    .controls-section {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 20px;
    }

    .transaction-details {
        flex-direction: column;
        gap: 10px;
    }

    .summary-icon {
        font-size: 1.5rem;
    }

    .summary-value {
        font-size: 1.2rem;
    }
}

/* Scrollbar Styling */
.transaction-list::-webkit-scrollbar {
    width: 6px;
}

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

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

.transaction-list::-webkit-scrollbar-thumb:hover {
    background: #5a67d8;
}

/* Login Screen */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-container {
    background: #2d2d2d;
    padding: 3rem;
    border-radius: 15px;
    border: 1px solid #444;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.login-header {
    margin-bottom: 2rem;
}

.login-header i {
    font-size: 3rem;
    color: #6c63ff;
    margin-bottom: 1rem;
}

.login-header h2 {
    color: #fff;
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

.login-header p {
    color: #999;
    font-size: 0.9rem;
}

.login-form .input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.login-form label {
    display: block;
    color: #fff;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 12px 15px;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.login-form input:focus {
    outline: none;
    border-color: #6c63ff;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: #6c63ff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-bottom: 1rem;
}

.login-btn:hover {
    background: #5a52d5;
}

.login-error {
    color: #ff6b6b;
    font-size: 0.9rem;
    padding: 10px;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 5px;
}

/* Header Updates */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.app-title {
    color: #fff;
    font-size: 1.8rem;
    margin: 0;
}

.logout-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.logout-btn:hover {
    background: #ff5252;
}

/* Number formatting enhancement */
.currency-input {
    font-family: 'Courier New', monospace;
    text-align: right;
}

/* Improved helper text */
.helper-text.success {
    color: #28a745;
    font-weight: 500;
}
/* 1. Bỏ hiệu ứng màu xanh khi nhấn trên mobile (WebKit-based) */
* {
  -webkit-tap-highlight-color: transparent;
}

/* 2. Bỏ outline khi focus (nếu không cần accessibility) */
button,
a,
input,
textarea {
  outline: none;
}

/* 3. Bỏ border hay hiệu ứng nhấn khác nếu có */
button,
a {
  border: none;
  background: none; /* nếu bạn có custom background rồi thì bỏ dòng này */
}

/* 4. Optional: bỏ focus ring trên Firefox */
button::-moz-focus-inner {
  border: 0;
}
