/* --- CSS Reset & Global Settings --- */
:root {
    --primary-color: #007aff;
    --primary-color-light: #409cff;
    --success-color: #34c759;
    --danger-color: #ff3b30;
    --warning-color: #ff9500;
    --bg-color: #f0f2f5;
    --panel-bg: rgba(255, 255, 255, 0.85);
    --text-color-primary: #1d1d1f;
    --text-color-secondary: #6e6e73;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.1);
    --input-bg: #f8f8f9;
}

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

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color-primary);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 2rem;
}

/* --- Login Page Specific --- */
.login-body {
    align-items: center;
}
.login-container {
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.flash-message {
    padding: 0.8rem 1.2rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    border: 1px solid transparent;
}
.flash-message.success { background-color: rgba(52, 199, 89, 0.15); color: #28a745; border-color: rgba(52, 199, 89, 0.2); }
.flash-message.error { background-color: rgba(255, 59, 48, 0.1); color: var(--danger-color); border-color: rgba(255, 59, 48, 0.2); }
.flash-message.info { background-color: rgba(0, 122, 255, 0.1); color: var(--primary-color); border-color: rgba(0, 122, 255, 0.2); }


/* --- Main Layout --- */
.main-container {
    width: 100%;
    max-width: 1500px;
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
}
header h1 { font-size: 2.5rem; font-weight: 700; }
header p { font-size: 1.1rem; font-weight: 300; color: var(--text-color-secondary); margin-top: 0.5rem;}
.logout-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 0;
    text-decoration: none;
    color: var(--text-color-secondary);
    background: rgba(0,0,0,0.04);
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    transition: all 0.2s ease-in-out;
    font-size: 0.9rem;
}
.logout-btn:hover { background: rgba(0,0,0,0.08); color: var(--primary-color); }
.logout-btn i { margin-right: 0.5rem; }

.content-wrapper {
    display: grid;
    grid-template-columns: minmax(550px, 1.2fr) 1fr;
    gap: 2rem;
    align-items: flex-start;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-medium);
    padding: 2.5rem;
}

/* --- Forms & Inputs --- */
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    font-size: 1rem;
}
.form-group label i {
    margin-right: 0.75rem;
    color: var(--primary-color);
    width: 20px;
    text-align: center;
}

input[type="text"], input[type="number"], input[type="date"], textarea {
    width: 100%;
    padding: 0.9rem 1.1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
}
textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

/* --- Buttons --- */
.btn {
    display: flex;
    justify-content: center;
    align-items: center;
    /* OPTIMIZATION: Adjusted padding for better visual balance on buttons */
    padding: 0.9rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 500;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}
.btn-primary {
    color: white;
    background-image: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-color-light) 100%);
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.25);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 7px 20px rgba(0, 122, 255, 0.35);
}
.btn:disabled { background: #bdc3c7; cursor: not-allowed; box-shadow: none; transform: none; }
.btn .btn-icon { margin-right: 0.75rem; transition: transform 0.3s ease; }
.btn:hover:not(:disabled) .btn-icon { transform: rotate(-10deg) scale(1.1); }

.btn-text {
    background: none; border: none; color: var(--primary-color);
    cursor: pointer; font-size: 0.9rem; font-weight: 500; padding: 0.5rem;
    border-radius: 8px; transition: all 0.3s ease; display: inline-flex; align-items: center;
}
.btn-text:hover { background-color: rgba(0, 122, 255, 0.1); }
.btn-text i { margin-right: 0.5rem; }

/* --- Accordions --- */
.accordion {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}
.accordion:last-of-type { border-bottom: none; }
.accordion-header {
    background: none; border: none; width: 100%;
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 0.5rem; cursor: pointer;
}
.accordion-header h2 { margin: 0; color: var(--text-color-primary); font-weight: 500; font-size: 1.25rem; }
.accordion-header h2 i { margin-right: 1rem; color: var(--text-color-secondary); }
.accordion-icon { transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1); }
.accordion.open .accordion-icon { transform: rotate(180deg); }
.accordion-content {
    max-height: 0; overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.25, 0.1, 0.25, 1), padding 0.5s ease;
    padding: 0 0.5rem;
}
.accordion.open .accordion-content {
    max-height: 2000px;
    padding: 0.5rem 0.5rem 1.5rem 0.5rem;
}

/* --- Account Table --- */
#account-table-container { width: 100%; overflow-x: auto; }
#account-table { width: 100%; border-collapse: collapse; }
#account-table th, #account-table td { padding: 0.8rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border-color); }
#account-table thead { border-bottom: 2px solid var(--border-color); }
#account-table th { font-weight: 500; font-size: 0.9rem; color: var(--text-color-secondary); }
#account-table tbody tr:last-child td { border-bottom: none; }
#account-table input, #account-table textarea {
    padding: 0.6rem 0.8rem; font-size: 0.95rem; border-radius: 8px;
    background-color: white;
}
#account-table textarea {
    min-height: 38px;
    height: 38px;
    resize: none;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    line-height: 1.4;
    transition: height 0.2s ease;
}
#account-table textarea:focus {
    overflow: auto;
    white-space: pre-wrap;
    text-overflow: initial;
    height: auto;
    min-height: 80px;
}
.delete-account-btn {
    background: transparent; border: none; color: var(--text-color-secondary);
    width: 38px; height: 38px; border-radius: 50%;
    cursor: pointer; transition: all 0.3s ease;
    display: flex; align-items: center; justify-content: center;
}
.delete-account-btn:hover { background-color: rgba(255, 59, 48, 0.1); color: var(--danger-color); }
.add-account-btn { margin-top: 1.5rem; width: 100%; justify-content: center; border: 1px dashed var(--border-color); }
.add-account-btn:hover { border-color: var(--primary-color); }

/* --- Log Panel --- */
.log-header {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem; margin-bottom: 1.5rem;
}
.log-header h2 { margin: 0; font-weight: 500; font-size: 1.25rem; }
.log-header h2 i { margin-right: 1rem; color: var(--text-color-secondary); }

#log-output {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 1.5rem; border-radius: 16px; height: 550px;
    overflow-y: auto; white-space: pre-wrap; word-wrap: break-word;
    font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace; font-size: 0.9rem; line-height: 1.7;
}
#download-area {
    margin-top: 1.5rem;
    opacity: 0; transform: translateY(15px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    visibility: hidden;
}
#download-area.show { opacity: 1; transform: translateY(0); visibility: visible; }
.download-btn {
    background-color: var(--success-color);
    box-shadow: 0 4px 15px rgba(52, 199, 89, 0.25);
}
.download-btn:hover {
    box-shadow: 0 7px 20px rgba(52, 199, 89, 0.35);
}
.download-btn i { margin-right: 0.75rem; }

/* --- Animations & Responsive --- */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%; border-top-color: #fff;
    width: 20px; height: 20px;
    animation: spin 1s linear infinite; margin-left: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1200px) {
    .content-wrapper { grid-template-columns: 1fr; }
    .log-panel { max-height: 600px; }
}
@media (max-width: 768px) {
    body { padding: 1rem; }
    header h1 { font-size: 2rem; }
    header p { font-size: 1rem; }
    .content-wrapper { gap: 1.5rem; }
    .glass-panel { padding: 1.5rem; border-radius: 20px;}
    .logout-btn {
        position: static;
        transform: none;
        margin-top: 1rem;
        display: inline-block;
    }
    header { margin-bottom: 1.5rem; }
}
