/* General Reset & Layout */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #ffffff;
    color: #2c3e50;
    padding: 10px 15px;
    font-size: 13px;
}

/* Top Navigation Bar */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e2e8f0;
}

.home-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 34px;
    height: 34px;
    background-color: #394b59;
    color: #fff;
    border-radius: 50%;
    text-decoration: none;
    font-size: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transition: transform 0.1s, background-color 0.2s;
}

.home-btn:hover {
    background-color: #25333d;
    transform: scale(1.05);
}

.nav-status {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.connected {
    background-color: #2ecc71;
    box-shadow: 0 0 8px #2ecc71;
}

.status-dot.disconnected {
    background-color: #e74c3c;
    box-shadow: 0 0 8px #e74c3c;
}

.capital-badge {
    font-size: 14px;
    font-weight: bold;
    color: #1e293b;
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
}

.logout-link {
    color: #64748b;
    text-decoration: none;
    font-size: 12px;
}

.logout-link:hover {
    color: #e74c3c;
    text-decoration: underline;
}

/* Main Container */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Data Table */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 15px;
    border: 1px solid #cce3f5;
    border-radius: 4px;
}

.grid-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background-color: #ffffff;
}

.grid-table th {
    background-color: #dbeafe;
    color: #1e3a8a;
    padding: 8px 6px;
    text-align: center;
    border: 1px solid #bfdbfe;
    font-weight: 600;
    white-space: nowrap;
}

.grid-table td {
    padding: 6px 5px;
    text-align: center;
    border: 1px solid #e0f2fe;
    vertical-align: middle;
}

.grid-table tr:nth-child(even) {
    background-color: #f0f9ff;
}

.grid-table tr:hover {
    background-color: #e0f2fe;
}

/* Table Cells Formatting */
.ticker-link {
    color: #0284c7;
    font-weight: bold;
    text-decoration: none;
}

.ticker-link:hover {
    text-decoration: underline;
    color: #0369a1;
}

.badge-type {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    background-color: #e2e8f0;
    color: #475569;
}

.badge-type.shares { background-color: #dbeafe; color: #1e40af; }
.badge-type.etfs { background-color: #fef3c7; color: #92400e; }
.badge-type.bonds { background-color: #dcfce7; color: #166534; }
.badge-type.futures { background-color: #f3e8ff; color: #6b21a8; }

.price-list {
    font-size: 11px;
    line-height: 1.3;
    max-height: 90px;
    overflow-y: auto;
    font-family: Consolas, monospace;
}

.pnl-positive { color: #15803d; font-weight: bold; }
.pnl-negative { color: #b91c1c; font-weight: bold; }
.pnl-neutral { color: #64748b; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease-in-out;
}

.btn-table {
    padding: 3px 8px;
    margin: 2px;
    font-size: 10px;
    background-color: #394b59;
    color: #ffffff;
}

.btn-table:hover {
    background-color: #25333d;
}

.btn-table-danger {
    background-color: #be123c;
    color: #ffffff;
}

.btn-table-danger:hover {
    background-color: #9f1239;
}

.btn-table-success {
    background-color: #15803d;
    color: #ffffff;
}

.btn-table-success:hover {
    background-color: #166534;
}

/* Table Action Buttons Toolbar */
.action-btn-group {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    white-space: nowrap;
}

tbody tr:hover {
    position: relative;
    z-index: 20;
}

.act-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 7px;
    border: 1px solid #cbd5e1;
    background-color: #ffffff;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    padding: 0;
}

.act-btn svg {
    width: 17px;
    height: 17px;
    display: block;
}

.act-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.12);
}

/* Custom Floating Tooltip */
.act-btn[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background-color: #0f172a;
    color: #ffffff;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 500;
    font-family: Arial, sans-serif;
    white-space: nowrap;
    border-radius: 5px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s ease;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    z-index: 1000;
    letter-spacing: 0.2px;
}

.act-btn[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: #0f172a transparent transparent transparent;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s ease;
    z-index: 1000;
}

.act-btn[data-tooltip]:hover::before,
.act-btn[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.act-btn-start {
    background-color: #f0fdf4;
    border-color: #86efac;
    color: #16a34a;
}

.act-btn-start:hover {
    background-color: #16a34a;
    border-color: #16a34a;
    color: #ffffff;
}

.act-btn-stop {
    background-color: #fff1f2;
    border-color: #fca5a5;
    color: #e11d48;
}

.act-btn-stop:hover {
    background-color: #e11d48;
    border-color: #e11d48;
    color: #ffffff;
}

.act-btn-edit {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    color: #334155;
}

.act-btn-edit:hover {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.act-btn-liquidate {
    background-color: #fef2f2;
    border-color: #fca5a5;
    color: #dc2626;
}

.act-btn-liquidate:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
    color: #ffffff;
}

.act-btn-delete {
    background-color: #f8fafc;
    border-color: #e2e8f0;
    color: #64748b;
}

.act-btn-delete:hover {
    background-color: #475569;
    border-color: #475569;
    color: #ffffff;
}

/* Action Buttons Bar */
.actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.btn-action {
    background-color: #394b59;
    color: #ffffff;
    padding: 7px 14px;
    border-radius: 18px;
    font-size: 11px;
}

.btn-action:hover {
    background-color: #25333d;
}

/* Master Control */
.master-control-bar {
    margin-bottom: 15px;
}

.btn-master {
    padding: 8px 18px;
    font-size: 12px;
    border-radius: 20px;
}

.btn-master.btn-danger {
    background-color: #394b59;
    color: #ffffff;
}

.btn-master.btn-success {
    background-color: #15803d;
    color: #ffffff;
}

/* Logs Console */
.log-section {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background-color: #ffffff;
    overflow: hidden;
}

.log-header {
    background-color: #f1f5f9;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    color: #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
}

.log-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.log-header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-log-mode {
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: #dcfce7;
    color: #166534;
}

.badge-log-mode.archive {
    background-color: #fef3c7;
    color: #92400e;
}

.log-date-picker {
    padding: 2px 6px;
    font-size: 11px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    color: #1e293b;
    outline: none;
    background-color: #ffffff;
}

.btn-log-action {
    background-color: #e2e8f0;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    font-weight: 500;
}

.btn-log-action:hover {
    background-color: #cbd5e1;
    color: #0f172a;
}

.btn-clear-log {
    background: none;
    border: none;
    color: #64748b;
    font-size: 11px;
    cursor: pointer;
    text-decoration: underline;
}

.btn-clear-log:hover {
    color: #0f172a;
}

.log-console {
    height: 200px;
    overflow-y: auto;
    background-color: #ffffff;
    color: #1e293b;
    padding: 8px 12px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px;
    line-height: 1.45;
}

.log-line {
    white-space: pre-wrap;
    word-break: break-all;
    border-bottom: 1px solid #f1f5f9;
    padding: 3px 0;
}

.log-line.error { color: #dc2626; font-weight: 600; }
.log-line.warning { color: #d97706; font-weight: 600; }
.log-line.success { color: #16a34a; font-weight: 600; }


/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: #ffffff;
    width: 440px;
    max-width: 95%;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    background: #dbeafe;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #bfdbfe;
}

.modal-header h3 {
    font-size: 15px;
    color: #1e3a8a;
    margin: 0;
}

.close-btn {
    font-size: 20px;
    cursor: pointer;
    color: #64748b;
}

.close-btn:hover {
    color: #0f172a;
}

.modal-body {
    padding: 16px;
}

.form-row {
    margin-bottom: 12px;
}

.form-row label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #334155;
}

.modal-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}

.modal-input:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.modal-actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
}

.btn-primary {
    background-color: #394b59;
    color: #ffffff;
    padding: 8px 18px;
    font-size: 12px;
    border-radius: 18px;
}

.btn-primary:hover {
    background-color: #25333d;
}
