/* style.css - COMPLETE FIXED VERSION WITH MENU BAR FIX */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* =========================================== */
/* FIXED MENU BAR - IMPROVED VERSION */
/* =========================================== */

/* Navbar fixes */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    height: 70px;
    box-sizing: border-box;
}

/* Add padding to body to prevent content hiding under fixed navbar */
body {
    padding-top: 70px;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
    margin: 0;
}

/* Container adjustment */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Brand/Logo styling */
.brand {
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
    text-decoration: none;
}

.brand a {
    color: #2c3e50;
    text-decoration: none;
}

/* Left section */
.nav-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Right section */
.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-right: 30px;
}

/* Menu button */
.menu-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #4a5568;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 5px;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-btn:hover {
    background-color: #edf2f7;
}

/* Profile button */
.profile-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    padding: 8px 15px;
    border-radius: 50px;
    background-color: #edf2f7;
    cursor: pointer;
    font-weight: 600;
    color: #4a5568;
    transition: background-color 0.3s;
}

.profile-btn:hover {
    background-color: #e2e8f0;
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 45px;
    background-color: white;
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    z-index: 1001;
    overflow: hidden;
}

.dropdown-content a {
    color: #4a5568;
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.3s;
}

.dropdown-content a:hover {
    background-color: #f7fafc;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Side Menu */
.side-menu {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    background-color: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1002;
    transition: left 0.3s ease;
    overflow-y: auto;
    padding-top: 70px; /* Add padding to account for fixed navbar */
}

.side-menu.active {
    left: 0;
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.menu-header h3 {
    color: #2d3748;
    font-size: 20px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #718096;
}

.menu-items {
    list-style: none;
    padding: 10px 0;
}

.menu-items li a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s;
}

.menu-items li a:hover {
    background-color: #f7fafc;
    color: #4299e1;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    display: none;
}

.overlay.active {
    display: block;
}

/* Main content */
.main-content {
    padding: 20px;
    transition: margin-left 0.3s;
    min-height: calc(100vh - 70px); /* Adjust for fixed navbar */
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 25px;
    background-color: #4299e1;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.3s;
}

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

.btn.secondary {
    background-color: #a0aec0;
}

.btn.secondary:hover {
    background-color: #718096;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    border-color: #4299e1;
    outline: none;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
}

/* Alerts */
.alert {
    padding: 12px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert.error {
    background-color: #fde8e8;
    color: #c53030;
    border-left: 4px solid #c53030;
}

.alert.success {
    background-color: #def7ec;
    color: #0e9f6e;
    border-left: 4px solid #0e9f6e;
}

/* Dashboard Cards */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.card {
    background-color: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: center;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.card i {
    color: #4299e1;
    margin-bottom: 15px;
}

.card h3 {
    margin-bottom: 10px;
    color: #2d3748;
}

.card p {
    color: #718096;
    margin-bottom: 20px;
}

/* =========================================== */
/* STOCK DASHBOARD SPECIFIC STYLES */
/* =========================================== */

/* Balance Info */
.balance-info {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.balance-item {
    text-align: center;
    flex: 1;
    min-width: 150px;
}

.balance-label {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.balance-value {
    font-size: 18px;
    font-weight: bold;
}

/* Dashboard Header */
.dashboard-header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.dashboard-header h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.dashboard-header p {
    opacity: 0.9;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    text-align: center;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card h3 {
    color: #7f8c8d;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: bold;
    color: #2c3e50;
}

/* Filters */
.filters {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    flex: 1;
    min-width: 250px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    color: #34495e;
    font-weight: 500;
}

.filter-group input, .filter-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ecf0f1;
    border-radius: 6px;
    font-size: 16px;
}

.filter-group input:focus, .filter-group select:focus {
    outline: none;
    border-color: #3498db;
}

/* RESPONSIVE STOCKS TABLE */
.stocks-table {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    overflow-x: auto;
}

.table-header {
    padding: 20px;
    background: #34495e;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.table-header h3 {
    margin: 0;
    font-size: 18px;
}

/* Table Container for Responsive Design */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Main Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

thead {
    background: #ecf0f1;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #bdc3c7;
    white-space: nowrap;
}

td {
    padding: 15px;
    border-bottom: 1px solid #ecf0f1;
    vertical-align: middle;
}

tr:hover {
    background: #f8f9fa;
}

/* Stock Symbol */
.stock-symbol {
    font-weight: bold;
    color: #2c3e50;
    font-size: 16px;
}

/* Sector Badge */
.sector-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #e8f4fc;
    color: #3498db;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

/* Price */
.price {
    font-weight: bold;
    color: #27ae60;
    font-size: 16px;
}

/* Market Cap */
.market-cap {
    font-weight: 500;
    color: #7f8c8d;
    font-size: 14px;
}

/* Actions */
.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.action-view {
    background: #3498db;
    color: white;
}

.action-trade {
    background: #27ae60;
    color: white;
}

.action-btn:hover {
    opacity: 0.9;
}

/* No Data Message */
.no-data {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

.no-data h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

/* =========================================== */
/* TRADE PANEL STYLES */
/* =========================================== */

/* Trade Panel */
#tradePanel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.trade-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    max-height: 90vh;
    overflow-y: auto;
}

.trade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.trade-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 24px;
}

.trade-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #7f8c8d;
}

.trade-content {
    margin-bottom: 20px;
}

.stock-info {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stock-info .stock-symbol {
    font-size: 24px;
    margin-bottom: 5px;
}

.stock-info .stock-name {
    color: #7f8c8d;
    font-size: 14px;
    margin-bottom: 10px;
}

.stock-info .stock-price {
    font-size: 18px;
    font-weight: bold;
    color: #27ae60;
}

/* Order Type */
.order-type {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.type-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.type-btn.active {
    background: #3498db;
    color: white;
}

.type-btn:hover:not(.active) {
    background: #e8f4fc;
}

/* Quantity Control */
.quantity-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.qty-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.qty-btn:hover {
    background: #3498db;
    color: white;
}

#quantity, #priceInput {
    flex: 1;
    height: 40px;
    border: 2px solid #ecf0f1;
    border-radius: 6px;
    padding: 0 15px;
    font-size: 16px;
    text-align: center;
    font-weight: 600;
}

#priceInput {
    width: 100%;
    margin-bottom: 20px;
}

/* Order Value */
.order-value {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}

#totalValue {
    font-size: 24px;
    font-weight: bold;
    color: #27ae60;
    display: block;
}

.order-value small {
    color: #7f8c8d;
    font-size: 13px;
}

/* Trade Buttons */
.trade-buttons {
    display: flex;
    gap: 10px;
}

.trade-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-buy {
    background: #27ae60;
    color: white;
}

.btn-buy:hover {
    background: #219653;
}

.btn-sell {
    background: #e74c3c;
    color: white;
}

.btn-sell:hover {
    background: #c0392b;
}

.btn-cancel {
    background: #95a5a6;
    color: white;
}

.btn-cancel:hover {
    background: #7f8c8d;
}

/* Notification */
.notification {
    position: fixed;
    top: 90px; /* Adjusted for fixed navbar (70px + 20px) */
    right: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    display: none;
    min-width: 300px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    background: #27ae60;
    border-left: 4px solid #219653;
}

.notification.error {
    background: #e74c3c;
    border-left: 4px solid #c0392b;
}

/* =========================================== */
/* RESPONSIVE DESIGN */
/* =========================================== */

/* Tablet Devices (768px and below) */
@media (max-width: 768px) {
    body {
        padding-top: 60px; /* Adjust for smaller navbar */
    }
    
    .navbar {
        padding: 10px 20px;
        height: 60px;
    }
    
    .container {
        padding: 15px;
    }
    
    .brand {
        font-size: 20px;
    }
    
    .nav-right {
        margin-right: 15px;
    }
    
    .profile-btn span {
        display: none; /* Hide text on tablet */
    }
    
    .profile-btn {
        padding: 8px 12px;
    }
    
    .side-menu {
        padding-top: 60px; /* Adjust for smaller navbar */
    }
    
    .main-content {
        min-height: calc(100vh - 60px);
    }
    
    .dashboard-header {
        padding: 20px;
    }
    
    .dashboard-header h1 {
        font-size: 24px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .balance-info {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .balance-item {
        min-width: 100%;
    }
    
    .filters {
        flex-direction: column;
        gap: 15px;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
    
    /* Responsive Table */
    .table-container {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        display: table;
        width: 100%;
        min-width: 600px;
    }
    
    /* Make table cells stack on mobile */
    @media (max-width: 600px) {
        table, thead, tbody, th, td, tr {
            display: block;
        }
        
        thead tr {
            display: none;
        }
        
        tr {
            margin-bottom: 15px;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            padding: 10px;
        }
        
        td {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px;
            border: none;
            border-bottom: 1px solid #f1f1f1;
        }
        
        td:before {
            content: attr(data-label);
            font-weight: bold;
            color: #2c3e50;
            margin-right: 10px;
        }
        
        td:last-child {
            border-bottom: none;
        }
        
        /* Add data labels for mobile */
        td:nth-of-type(1):before { content: "Symbol: "; }
        td:nth-of-type(2):before { content: "Company: "; }
        td:nth-of-type(3):before { content: "Sector: "; }
        td:nth-of-type(4):before { content: "Market Cap: "; }
        td:nth-of-type(5):before { content: "Price: "; }
        td:nth-of-type(6):before { content: "Actions: "; }
    }
    
    .trade-container {
        width: 95%;
        max-width: none;
        padding: 15px;
    }
    
    .trade-buttons {
        flex-direction: column;
    }
    
    .notification {
        top: 80px; /* Adjusted for smaller navbar */
        min-width: 90%;
        right: 5%;
        left: 5%;
    }
}

/* Mobile Devices (480px and below) */
@media (max-width: 480px) {
    body {
        padding-top: 55px;
    }
    
    .navbar {
        padding: 8px 15px;
        height: 55px;
    }
    
    .nav-left, .nav-right {
        gap: 8px;
    }
    
    .nav-right {
        margin-right: 10px;
    }
    
    .menu-btn {
        padding: 6px 8px;
        font-size: 20px;
    }
    
    .profile-btn {
        padding: 6px 10px;
    }
    
    .profile-btn i {
        font-size: 16px;
    }
    
    .brand {
        font-size: 18px;
    }
    
    .side-menu {
        padding-top: 55px;
    }
    
    .main-content {
        min-height: calc(100vh - 55px);
        padding: 15px;
    }
    
    .dashboard-header {
        padding: 15px;
    }
    
    .dashboard-header h1 {
        font-size: 20px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-card .value {
        font-size: 24px;
    }
    
    .order-type {
        flex-direction: column;
    }
    
    .quantity-control {
        flex-direction: column;
        align-items: stretch;
    }
    
    .qty-btn {
        width: 100%;
        margin: 5px 0;
    }
    
    #quantity, #priceInput {
        width: 100%;
        margin: 10px 0;
    }
}

/* Print Styles */
@media print {
    .navbar, .side-menu, .overlay, .filters, .actions, .notification {
        display: none !important;
    }
    
    body {
        padding-top: 0;
    }
    
    .stocks-table {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    table {
        width: 100%;
        border-collapse: collapse;
    }
    
    th, td {
        border: 1px solid #ddd;
        padding: 8px;
    }
    
    .main-content {
        padding: 0;
    }
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #2c3e50;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Profile page */
.profile-card {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-top: 30px;
}

.profile-header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #4299e1, #667eea);
    color: white;
}

.profile-icon {
    margin-bottom: 15px;
}

.profile-header h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.profile-details {
    padding: 30px;
}

.detail-row {
    display: flex;
    padding: 15px 0;
    border-bottom: 1px solid #e2e8f0;
}

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

.label {
    flex: 0 0 150px;
    font-weight: 600;
    color: #4a5568;
}

.value {
    flex: 1;
    color: #2d3748;
}

.active-status {
    color: #38a169;
    font-weight: 600;
}

.profile-actions {
    display: flex;
    gap: 15px;
    padding: 20px 30px;
    background-color: #f7fafc;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

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