/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #fff;
    min-height: 100vh;
    color: #111;
    line-height: 1.6;
}

/* Loading Screen Styles */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007AFF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loading-text {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-weight: 500;
}

.loading-status {
    color: #999;
    font-size: 0.9rem;
    text-align: center;
    max-width: 300px;
}

.error-message {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: center;
    max-width: 400px;
}

.error-message h3 {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.error-message button {
    margin-top: 10px;
    padding: 8px 16px;
    background: #007AFF;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.error-message button:hover {
    background: #0056B3;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
    color: #111;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    opacity: 0.8;
}

/* Main Content */
main {
    display: grid;
    gap: 2rem;
}

section {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.add-stock-section h2,
.stocks-section h2 {
    margin-bottom: 1rem;
    color: #111;
    font-size: 1.5rem;
}

/* Form Styles */
.form-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-group input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #007AFF;
}

.form-group button {
    padding: 12px 24px;
    background: #007AFF;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-group button:hover {
    background: #0056B3;
}

.form-group button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.controls button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #6C757D;
    color: #fff;
}

.controls button:hover {
    background: #495057;
}

/* Portfolio Summary */
.portfolio-summary {
    background: #F8F9FA;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #6C757D;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #888;
}

.empty-state p:first-child {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Stock Table */
.stocks-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: #fff;
}

.stocks-table th,
.stocks-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #E9ECEF;
}

.stocks-table th {
    background: #F8F9FA;
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stocks-table tr:hover {
    background: #F8F9FA;
}

.stock-symbol {
    font-weight: 600;
    font-size: 1.1rem;
    color: #007AFF;
}

.stock-price {
    font-weight: 600;
    font-size: 1.1rem;
}

.stock-change {
    font-weight: 600;
}

.positive {
    color: #28A745;
}

.negative {
    color: #DC3545;
}

.neutral {
    color: #6C757D;
}

.loading {
    color: #007AFF;
    font-style: italic;
}

.error {
    color: #DC3545;
    font-size: 0.9rem;
}

.target-input {
    width: 100px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.target-input:focus {
    outline: none;
    border-color: #007AFF;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    text-align: center;
    display: inline-block;
    min-width: 80px;
}

.status-above {
    background: #D4EDDA;
    color: #155724;
}

.status-below {
    background: #F8D7DA;
    color: #721C24;
}

.status-at {
    background: #D1ECF1;
    color: #0C5460;
}

.delete-btn {
    background: #DC3545;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.delete-btn:hover {
    background: #C82333;
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 2rem;
    color: #6C757D;
    font-size: 0.9rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.4);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}
.modal[style*="display: flex"] {
    display: flex !important;
}
.modal > div {
    background: #fff;
    padding: 2rem 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    min-width: 320px;
    max-width: 90vw;
    text-align: center;
    position: relative;
}
#googleSignInBtn {
    padding: 12px 24px;
    background: #4285F4;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
    transition: background 0.2s;
}
#googleSignInBtn:hover {
    background: #3367D6;
}
#authError {
    color: #dc3545;
    margin-top: 10px;
    min-height: 24px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .form-group {
        flex-direction: column;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stocks-table {
        font-size: 0.9rem;
    }
    
    .stocks-table th,
    .stocks-table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .stocks-table {
        font-size: 0.8rem;
    }
    
    .target-input {
        width: 80px;
    }
    
    .controls {
        width: 100%;
        justify-content: center;
    }
    
    .loading-text {
        font-size: 1rem;
    }
    
    .loading-status {
        font-size: 0.8rem;
        padding: 0 20px;
    }
}