/* Portfolio Summary */
.portfolio-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.summary-card .label {
    color: #718096;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.summary-card .value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2d3748;
}

.summary-card .value.highlight {
    color: #22c55e;
}

/* Market Feed Section */
.market-feed-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.feed-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.feed-btn {
    padding: 8px 16px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.feed-btn:hover {
    background: #e2e8f0;
}

.feed-btn.active {
    background: #22c55e;
    color: white;
    border-color: #22c55e;
}

.market-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.stock-card {
    background: #f8fafc;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.3s;
}

.stock-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: #22c55e;
}

.stock-card .symbol {
    font-weight: bold;
    font-size: 1.1rem;
    color: #2d3748;
    display: block;
    margin-bottom: 5px;
}

.stock-card .name {
    font-size: 0.8rem;
    color: #718096;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stock-card .price {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 5px;
}

.stock-card .change {
    font-size: 0.9rem;
}

.stock-card .change.positive {
    color: #22c55e;
}

.stock-card .change.negative {
    color: #ef4444;
}

.feed-update-time {
    text-align: center;
    color: #718096;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

/* Trade Section */
.trade-section {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.trade-container {
    max-width: 600px;
    margin: 0 auto;
}

.trade-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.trade-input-group input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    text-transform: uppercase;
}

.lookup-btn {
    padding: 12px 24px;
    background: #22c55e;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.lookup-btn:hover {
    background: #16a34a;
}

.stock-quote {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.quote-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.quote-header h3 {
    margin: 0;
    color: #2d3748;
}

.quote-symbol {
    background: #22c55e;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: bold;
}

.quote-price {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.current-price {
    font-size: 2rem;
    font-weight: bold;
    color: #2d3748;
}

.price-change {
    font-size: 1.1rem;
    color: #718096;
}

.trade-form {
    background: white;
    padding: 20px;
    border-radius: 10px;
}

.trade-type {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.type-btn {
    flex: 1;
    padding: 10px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.type-btn.active {
    background: #22c55e;
    color: white;
    border-color: #22c55e;
}

.trade-details .input-group {
    margin-bottom: 20px;
}

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

.trade-details input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1.1rem;
}

.trade-calculation {
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.calc-row:last-child {
    border-bottom: none;
    font-weight: bold;
    font-size: 1.1rem;
}

.execute-btn {
    width: 100%;
    padding: 15px;
    background: #22c55e;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.execute-btn:hover {
    background: #16a34a;
    transform: translateY(-2px);
}

.execute-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
}

/* Holdings Section */
.holdings-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.holdings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.holdings-header h2 {
    margin: 0;
}

.refresh-btn {
    padding: 8px 16px;
    background: #22c55e;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.refresh-btn:hover {
    background: #16a34a;
}

.refresh-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

.refresh-btn.loading #refreshIcon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.holdings-container {
    overflow-x: auto;
}

.holdings-table {
    width: 100%;
    border-collapse: collapse;
}

.holdings-table th {
    background: #f7fafc;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
}

.holdings-table td {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.holdings-table tbody tr:hover {
    background: #f8fafc;
}

.empty-message {
    text-align: center;
    color: #718096;
    padding: 30px !important;
    font-style: italic;
}

.gain {
    color: #22c55e;
    font-weight: 600;
}

.loss {
    color: #ef4444;
    font-weight: 600;
}

/* Performance Section */
.performance-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.chart-container {
    height: 300px;
    margin-bottom: 30px;
}

.performance-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: #f8fafc;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.stat-label {
    display: block;
    color: #718096;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 1.3rem;
    font-weight: bold;
    color: #2d3748;
}

/* Realized Gains Section */
.realized-gains-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 2px solid #22c55e;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.section-header h2 {
    margin: 0;
}

.info-tooltip {
    position: relative;
    display: inline-block;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #22c55e;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    cursor: help;
}

.tooltip-content {
    display: none;
    position: absolute;
    bottom: 30px;
    left: -100px;
    background: #2d3748;
    color: white;
    padding: 15px;
    border-radius: 8px;
    width: 250px;
    z-index: 100;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.info-tooltip:hover .tooltip-content {
    display: block;
}

.gains-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 10px;
}

.gains-summary .summary-item {
    text-align: center;
}

.gains-summary .label {
    display: block;
    color: #718096;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.gains-summary .value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
}

.gains-summary .value.gains {
    color: #22c55e;
}

.gains-summary .value.losses {
    color: #ef4444;
}

.gains-summary .summary-item.highlight {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

.realized-container {
    max-height: 400px;
    overflow-y: auto;
}

.realized-table {
    width: 100%;
    border-collapse: collapse;
}

.realized-table th {
    background: #f0fdf4;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    color: #166534;
    border-bottom: 2px solid #22c55e;
    position: sticky;
    top: 0;
    white-space: nowrap;
}

.realized-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #f1f5f9;
}

.realized-table .profit {
    color: #22c55e;
    font-weight: bold;
}

.realized-table .loss {
    color: #ef4444;
    font-weight: bold;
}

/* History Section */
.history-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.history-container {
    max-height: 400px;
    overflow-y: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    background: #f7fafc;
    padding: 10px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
}

.history-table td {
    padding: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.buy-transaction {
    background: #f0fdf4;
}

.sell-transaction {
    background: #fef2f2;
}

/* Tips Section */
.tips-section {
    background: #f8fafc;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.tip-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #22c55e;
}

.tip-card h4 {
    color: #22c55e;
    margin-bottom: 10px;
}

.tip-card p {
    color: #4a5568;
    line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .portfolio-summary {
        grid-template-columns: 1fr 1fr;
    }
    
    .market-feed {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .holdings-table {
        font-size: 0.9rem;
    }
    
    .holdings-table th,
    .holdings-table td {
        padding: 8px 5px;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: "...";
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: ".";
    }
    40% {
        content: "..";
    }
    60%, 100% {
        content: "...";
    }
}