/**
 * Fasmaapp Dark Theme Stylesheet
 * Mobile-first design based on Fasma Hellas screenshot
 *
 * @package Fasmaapp
 * @version 2.0.0
 */

/* ===== CSS Variables ===== */
:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #242424;
    --bg-header: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #999999;
    --text-muted: #666666;
    --border-color: #333333;
    --green: #4caf50;
    --red: #ff5252;
    --blue: #2196f3;
    --accent: #ffd700;
}

/* ===== Global Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-top: 60px;
    padding-bottom: 70px;
    overflow-x: hidden;
}

a {
    color: var(--blue);
    text-decoration: none;
}

/* ===== Top Header ===== */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.site-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
}

.datetime {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 15px;
}

.market-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.icon-btn.active {
    color: var(--blue);
}

.toggle-label {
    font-size: 12px;
    white-space: nowrap;
}

/* ===== Main Content ===== */
.main-content {
    max-width: 100%;
    padding: 0;
    min-height: calc(100vh - 130px);
}

/* ===== Controls Bar ===== */
.controls-bar {
    padding: 15px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.control-group {
    display: flex;
    gap: 10px;
}

.form-select {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
}

.form-select:focus {
    border-color: var(--blue);
}

/* ===== Sections ===== */
.metals-section,
.news-section {
    padding: 20px 15px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary);
}

/* ===== Price Table ===== */
.price-table {
    width: 100%;
}

.table-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 500;
}

.table-body {
    /* Rows will be added here */
}

.table-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 15px;
    align-items: center;
    transition: background 0.2s;
}

.table-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.table-row:last-child {
    border-bottom: none;
}

.col-metal {
    font-weight: 500;
    color: var(--text-primary);
}

.col-bid,
.col-ask {
    text-align: center;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.col-change {
    text-align: right;
    font-weight: 600;
}

.change-value.positive {
    color: var(--green);
}

.change-value.positive::before {
    content: '▲ ';
}

.change-value.negative {
    color: var(--red);
}

.change-value.negative::before {
    content: '▼ ';
}

/* ===== Info Text ===== */
.info-text {
    padding: 15px 0;
    color: var(--text-muted);
    font-size: 12px;
}

/* ===== News Feed ===== */
.news-feed {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.news-article {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.news-article:hover {
    border-color: var(--blue);
}

.news-article-image {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-primary);
}

.news-article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.news-article-content {
    flex: 1;
    min-width: 0;
}

.news-article-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.news-article-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.news-article-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: var(--text-muted);
}

.news-article-source {
    font-weight: 600;
    color: var(--blue);
}

/* ===== Watchlist Empty State ===== */
.watchlist-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.watchlist-empty i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.3;
}

.watchlist-empty p {
    font-size: 16px;
    margin-bottom: 8px;
}

.watchlist-empty small {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== Loading State ===== */
.loading-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

/* ===== Bottom Navigation ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg-header);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
}

.bottom-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 22px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
    height: 100%;
}

.bottom-nav .nav-item span {
    font-size: 11px;
    font-weight: 500;
}

.bottom-nav .nav-item:hover {
    color: var(--text-primary);
}

.bottom-nav .nav-item.active {
    color: var(--blue);
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .header-center {
        display: none;
    }

    .site-title {
        font-size: 16px;
    }

    .datetime {
        font-size: 11px;
    }

    .toggle-label {
        display: none;
    }

    .table-header,
    .table-row {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .header-left {
        gap: 8px;
    }

    .header-right {
        gap: 5px;
    }

    .icon-btn {
        padding: 6px;
        font-size: 16px;
    }
}

/* ===== Animations ===== */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Hidden Sections ===== */
section[style*="display: none"] {
    display: none !important;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* ===== Remove Bootstrap defaults that conflict ===== */
.container,
.container-fluid {
    padding: 0 !important;
}

.row {
    margin: 0 !important;
}
