/**
 * Smart Stock Pro - Frontend Styles
 * Version: 1.0.0
 */

/* =====================================================
   WIDGET STYLES
   ===================================================== */

.ssp-company-widget {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.ssp-company-header {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.ssp-company-name {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

.ssp-company-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ssp-ticker-badge {
    display: inline-block;
    background: linear-gradient(135deg, #5679FF 0%, #4a67db 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.ssp-sector-badge {
    display: inline-block;
    background: #f5f5f5;
    color: #666;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.ssp-stock-data {
    margin: 16px 0;
    min-height: 150px;
}

/* TradingView Widget Container */
.tradingview-widget-container {
    width: 100%;
    height: auto;
    margin: 0;
}

.tradingview-widget-container__widget {
    width: 100%;
    height: 100%;
}

.tradingview-widget-copyright {
    margin-top: 8px;
    text-align: right;
}

.blue-text {
    color: #5679FF;
    text-decoration: none;
    font-size: 12px;
}

.blue-text:hover {
    text-decoration: underline;
}

.ssp-open-modal-btn {
    width: 100%;
    background: linear-gradient(135deg, #5679FF 0%, #4a67db 100%);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(86, 121, 255, 0.3);
    margin-top: 16px;
}

.ssp-open-modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(86, 121, 255, 0.4);
}

.ssp-open-modal-btn:active {
    transform: translateY(0);
}

.ssp-btn-icon {
    font-size: 18px;
}

.ssp-btn-text {
    font-size: 15px;
}

/* Search Widget */
.ssp-search-widget {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.ssp-search-message {
    color: #666;
    font-size: 14px;
    margin-bottom: 16px;
}

.ssp-search-container {
    margin-top: 12px;
}

/* =====================================================
   MODAL STYLES
   ===================================================== */

.ssp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    animation: ssp-fadeIn 0.3s ease;
}

.ssp-modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.ssp-modal-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    max-width: 1200px;
    max-height: 90vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: ssp-slideUp 0.3s ease;
}

@keyframes ssp-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes ssp-slideUp {
    from {
        transform: translate(-50%, -45%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

/* Modal Header */
.ssp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 1px solid #e8e8e8;
    background: linear-gradient(to bottom, #ffffff 0%, #fafafa 100%);
}

.ssp-modal-title-wrapper {
    flex: 1;
}

.ssp-modal-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ssp-modal-ticker {
    color: #5679FF;
    font-size: 20px;
}

.ssp-modal-sector {
    display: inline-block;
    background: #f0f0f0;
    color: #666;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    margin-top: 8px;
}

.ssp-modal-close {
    background: #f5f5f5;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #666;
    margin-left: 16px;
}

.ssp-modal-close:hover {
    background: #e8e8e8;
    color: #333;
    transform: rotate(90deg);
}

/* Modal Tabs */
.ssp-modal-tabs {
    display: flex;
    border-bottom: 1px solid #e8e8e8;
    background: #f8f9fa;
    overflow-x: auto;
    flex-shrink: 0;
}

.ssp-tab-btn {
    padding: 16px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 15px;
    color: #666;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    white-space: nowrap;
}

.ssp-tab-btn:hover {
    background: rgba(86, 121, 255, 0.06);
    color: #5679FF;
}

.ssp-tab-btn.active {
    color: #5679FF;
    border-bottom-color: #5679FF;
    font-weight: 600;
    background: rgba(86, 121, 255, 0.1);
}

.ssp-tab-icon {
    font-size: 18px;
}

.ssp-tab-label {
    font-size: 15px;
}

/* Modal Content */
.ssp-modal-content {
    flex: 1;
    overflow-y: auto;
    background: #fafafa;
}

.ssp-tab-content {
    display: none;
    min-height: 500px;
    height: 600px;
    padding: 30px;
    background: white;
    animation: ssp-fadeIn 0.3s ease;
}

.ssp-tab-content.active {
    display: block;
}

/* TradingView in Modal */
.ssp-tab-content .tradingview-widget-container {
    height: 100%;
    width: 100%;
}

.ssp-tab-content .tradingview-widget-container__widget {
    height: calc(100% - 32px);
    width: 100%;
}

/* =====================================================
   RESPONSIVE DESIGN
   ===================================================== */

@media (max-width: 1024px) {
    .ssp-modal-container {
        width: 96%;
        max-height: 92vh;
    }

    .ssp-modal-header {
        padding: 20px 24px;
    }

    .ssp-modal-title {
        font-size: 22px;
    }

    .ssp-tab-content {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .ssp-modal-container {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: none;
    }

    .ssp-modal-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 0;
    }

    .ssp-tab-btn {
        flex: 0 0 auto;
        min-width: 130px;
        padding: 14px 16px;
        font-size: 14px;
    }

    .ssp-tab-content {
        padding: 20px;
    }

    .ssp-company-widget {
        padding: 16px;
    }

    .ssp-company-name {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .ssp-modal-header {
        padding: 16px;
    }

    .ssp-modal-title {
        font-size: 18px;
    }

    .ssp-modal-close {
        width: 38px;
        height: 38px;
    }

    .ssp-tab-btn {
        min-width: 110px;
        padding: 12px 12px;
        font-size: 13px;
    }

    .ssp-tab-icon {
        font-size: 16px;
    }

    .ssp-tab-label {
        font-size: 13px;
    }

    .ssp-tab-content {
        padding: 16px;
    }

    .ssp-company-widget {
        padding: 14px;
    }

    .ssp-open-modal-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* =====================================================
   COMPANIES LIST
   ===================================================== */

.ssp-companies-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.ssp-company-item {
    background: #ffffff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.ssp-company-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.ssp-company-item h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.ssp-company-item h3 a {
    color: #333;
    text-decoration: none;
}

.ssp-company-item h3 a:hover {
    color: #5679FF;
}

.ssp-company-ticker {
    display: inline-block;
    background: #f0f0f0;
    color: #333;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    margin-right: 8px;
}

.ssp-company-exchange {
    display: inline-block;
    background: #5679FF;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
}

/* =====================================================
   UTILITY CLASSES
   ===================================================== */

.ssp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #666;
}

.ssp-error {
    padding: 20px;
    background: #fff3f3;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
    color: #c62828;
    text-align: center;
}

.ssp-hidden {
    display: none !important;
}

/* Scrollbar Styling */
.ssp-modal-content::-webkit-scrollbar {
    width: 8px;
}

.ssp-modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.ssp-modal-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.ssp-modal-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}