:root {
    --bg-color: #0d1117;
    --text-main: #e6edf3;
    --text-muted: #7d8590;
    --accent-color: #2f81f7;
    --positive: #3fb950;
    --negative: #f85149;
    --card-bg: rgba(22, 27, 34, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Prompt', 'Athiti', sans-serif;
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 80% 20%, rgba(47, 129, 247, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 20% 80%, rgba(63, 185, 80, 0.1) 0%, transparent 40%);
    background-attachment: fixed;
    line-height: 1.6;
}

.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

header {
    text-align: center;
    margin-bottom: 4rem;
    animation: fadeInDown 0.8s ease backwards;
}

header h1 {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff, #7d8590);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    animation: fadeInUp 0.8s ease backwards;
}

.glass-card:nth-child(1) {
    animation-delay: 0.1s;
}

.glass-card:nth-child(2) {
    animation-delay: 0.2s;
}

.glass-card:nth-child(3) {
    animation-delay: 0.3s;
}

.glass-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

.glass-card h3 {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.8rem;
}

.glass-card p {
    font-size: 2.5rem;
    font-weight: 700;
}

.positive {
    color: var(--positive);
}

.negative {
    color: var(--negative);
}

.actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 2rem;
    animation: fadeIn 1s ease backwards 0.4s;
}

.btn {
    padding: 0.9rem 1.8rem;
    border-radius: 12px;
    border: none;
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent-color), #58a6ff);
    color: #fff;
    box-shadow: 0 4px 15px rgba(47, 129, 247, 0.3);
}

.primary-btn:hover {
    box-shadow: 0 8px 25px rgba(47, 129, 247, 0.5);
    transform: translateY(-3px) scale(1.02);
}

.primary-btn:active {
    transform: translateY(1px);
}

.history h2 {
    margin-bottom: 1.5rem;
    font-weight: 600;
    font-size: 1.5rem;
    animation: fadeIn 1s ease backwards 0.5s;
}

.table-container {
    padding: 0;
    overflow-x: auto;
    animation: fadeInUp 0.8s ease backwards 0.6s;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    min-width: 600px;
    font-size: 0.9rem;
}

th,
td {
    padding: 1rem 1rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    background-color: rgba(255, 255, 255, 0.02);
}

tbody tr {
    transition: all 0.2s ease;
}

tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(13, 17, 23, 0.95);
    overflow-y: auto;
    padding: 2rem 1rem;
}

.modal-content {
    background: var(--card-bg);
    margin: 0 auto;
    padding: 2.5rem;
    width: 100%;
    max-width: 600px;
    position: relative;
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.view-modal-content {
    max-width: 800px;
}

.close-btn {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    color: var(--text-muted);
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--text-main);
}

/* Form Styles */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.full-width {
    grid-column: 1 / -1;
    width: 100%;
}

label {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

input,
textarea,
select,
button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(47, 129, 247, 0.2);
    background: rgba(47, 129, 247, 0.05);
}

select option {
    background-color: var(--card-bg);
    color: var(--text-main);
}

.file-input {
    padding: 0.6rem;
}

.mt-2 {
    margin-top: 1.5rem;
}

.danger-btn {
    background: transparent;
    border: 1px solid var(--negative);
    color: var(--negative);
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
}

.danger-btn:hover {
    background: rgba(248, 81, 73, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(248, 81, 73, 0.2);
}

.action-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.trade-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 12px;
}

.detail-item span {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: block;
    margin-bottom: 0.2rem;
}

.detail-reason {
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 12px;
}

.detail-reason h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* Autocomplete Custom Styling */
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 99;
    max-height: 150px;
    overflow-y: auto;
    display: none;
    list-style: none;
    padding: 0;
    margin: 0;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
}

.autocomplete-list li {
    padding: 0.8rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    font-size: 0.9rem;
}

.autocomplete-list li:hover {
    background: rgba(255, 255, 255, 0.1);
}

.autocomplete-list li:last-child {
    border-bottom: none;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Login Screen Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-card {
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.login-card h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.login-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* Emotion Tags */
.emotion-tag {
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.emotion-tag:hover {
    background: rgba(255, 255, 255, 0.1);
}

.emotion-tag.selected-tag {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent);
    color: var(--text-main);
}

/* --- Responsive Layout Adjustments --- */
@media screen and (max-width: 768px) {
    .app-container {
        padding: 1.5rem 1rem !important;
    }

    header h1 {
        font-size: 2.2rem !important;
    }

    header p {
        font-size: 0.9rem !important;
    }

    .user-controls {
        flex-direction: column;
        width: 100%;
    }

    .user-controls>div,
    .user-controls>button {
        width: 100%;
        justify-content: center;
    }

    .nav-tabs {
        justify-content: flex-start;
        padding-bottom: 0.5rem;
    }

    .overview {
        grid-template-columns: 1fr;
    }

    .dashboard-cards {
        grid-template-columns: 1fr !important;
    }

    .glass-card {
        padding: 1.2rem;
    }

    .modal-content {
        width: 95% !important;
        margin: 5% auto !important;
        padding: 1.5rem !important;
    }

    .table-container {
        padding: 1rem 0;
    }

    .calendar-grid {
        gap: 0.2rem;
    }

    .calendar-day-header {
        font-size: 0.75rem;
        padding: 0.2rem;
    }

    .calendar-day {
        min-height: 60px;
        padding: 0.2rem;
    }

    .calendar-day .day-number {
        font-size: 0.8rem;
    }

    .calendar-day .day-pl {
        font-size: 0.75rem;
    }
}