/**
 * Frontend Styles for Starlink Usage Lookup
 */

/* Main Wrapper */
.starlink-lookup-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Form Container */
.starlink-lookup-form-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.starlink-greet-box {
    padding: 20px;
}

.starlink-lookup-title {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 20px 0;
    text-align: center;
}

/* Form */
.starlink-lookup-form {
    display: flex;
    justify-content: center;
}

.starlink-form-group {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    width: 100%;
    max-width: 800px;
}

/* View Toggle Buttons - Desktop */
.chart-view-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    justify-content: center;
}

.chart-view-btn {
    padding: 8px 20px;
    font-size: 13px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #666;
}

.chart-view-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.starlink-input {
    flex: 1;
    padding: 14px 20px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
    outline: none;
}

.starlink-input:focus {
    border-color: #2196F3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.starlink-button {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    justify-content: center;
}

.starlink-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.starlink-button:active {
    transform: translateY(0);
}

.starlink-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Spinner */
.spinner {
    animation: rotate 2s linear infinite;
    width: 20px;
    height: 20px;
}

.spinner .path {
    stroke: #ffffff;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

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

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* Results Container */
.starlink-results {
    animation: fadeIn 0.5s ease-in;
}

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

.starlink-results-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Vessel Header */
.starlink-vessel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.vessel-name {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.status-badge {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-online {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.5);
}

/* Tabs */
.starlink-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    background: #f9f9f9;
}

.starlink-tab {
    flex: 1;
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.starlink-tab:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.starlink-tab.active {
    color: #667eea;
    background: #ffffff;
}

.starlink-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

/* Tab Content */
.starlink-tab-content {
    padding: 30px;
}

/* Overview Section */
.starlink-overview-grid {
    display: grid;
    gap: 30px;
}

.starlink-chart-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.date-range {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    padding: 8px 16px;
    background: #f5f5f5;
    border-radius: 6px;
}

/* Chart Container - Donut Chart */
.starlink-chart-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto 30px;
}

.chart-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.chart-percent {
    font-size: 48px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1;
}

.chart-percent .unit {
    font-size: 24px;
    font-weight: 600;
}

.chart-caption {
    font-size: 13px;
    color: #666;
    margin-top: 8px;
    font-weight: 500;
}

/* Usage Summary */
.starlink-usage-summary {
    width: 100%;
    max-width: 600px;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    margin: 0 auto;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
}

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

.summary-row.highlight {
    background: linear-gradient(90deg, rgba(255, 87, 34, 0.1) 0%, transparent 100%);
    margin: 0 -20px;
    padding: 12px 20px;
    border-radius: 6px;
}

.summary-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.summary-value {
    font-size: 16px;
    color: #1a1a1a;
    font-weight: 600;
}

.summary-row.highlight .summary-value {
    color: #FF5722;
    font-size: 18px;
}

/* Data Used Section */
.starlink-data-used-section {
    max-width: 800px;
    margin: 0 auto;
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}

.date-selector label {
    font-weight: 600;
    color: #1a1a1a;
}

.starlink-select {
    flex: 1;
    padding: 10px 16px;
    font-size: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.starlink-select:focus {
    border-color: #667eea;
}

/* Chart Wrapper - Bar Chart */
.starlink-chart-wrapper {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    min-height: 500px;
}

.starlink-chart-wrapper canvas {
    min-height: 450px !important;
    height: 450px !important;
}

/* Usage Stats */
.starlink-usage-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* Desktop xếp ngang */
@media (min-width: 769px) {
    .starlink-usage-stats {
        grid-template-columns: 1fr 1fr;
    }
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.priority {
    background: linear-gradient(135deg, #FF5722 0%, #FF9800 100%);
}

.stat-icon.standard {
    background: linear-gradient(135deg, #2196F3 0%, #03A9F4 100%);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
    font-weight: 500;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
}

/* Error/No Data Messages */
.starlink-error,
.starlink-no-data {
    padding: 20px;
    text-align: center;
    color: #f44336;
    background: #ffebee;
    border-radius: 8px;
    margin-top: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .starlink-lookup-wrapper {
        padding: 15px;
    }

    .starlink-lookup-form-container {
        padding: 20px;
    }

    .starlink-form-group {
        grid-template-columns: 1fr;
    }

    .starlink-button {
        width: 100%;
    }

    .starlink-vessel-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .starlink-tab {
        padding: 12px 16px;
        font-size: 14px;
    }

    .starlink-tab-content {
        padding: 20px;
    }

    .starlink-chart-container {
        width: 250px;
        height: 250px;
    }

    .chart-percent {
        font-size: 36px;
    }

    /* Mobile: 2 ô Priority/Standard xếp ngang */
    .starlink-usage-stats {
        display: flex;
        gap: 12px;
        flex-wrap: wrap;
    }

    .starlink-usage-stats .stat-card {
        flex: 1;
        min-width: 140px;
        padding: 16px;
        gap: 12px;
    }

    .starlink-usage-stats .stat-icon {
        width: 40px;
        height: 40px;
    }

    .starlink-usage-stats .stat-value {
        font-size: 18px;
    }

    .starlink-usage-stats .stat-label {
        font-size: 12px;
    }

    /* Tăng chiều cao chart trên mobile */
    .starlink-chart-wrapper {
        min-height: 450px;
    }

    .starlink-chart-wrapper canvas {
        min-height: 400px !important;
        height: 400px !important;
    }
}

@media (max-width: 480px) {
    .starlink-lookup-title {
        font-size: 17px;
    }

    /* Không thay đổi chart tròn - giữ nguyên */
    .starlink-chart-container {
        width: 250px;
        height: 250px;
    }

    .chart-percent {
        font-size: 36px;
    }

    .chart-center-text .unit {
        font-size: 20px;
    }

    .chart-caption {
        font-size: 12px;
    }

    .summary-row {
        font-size: 13px;
    }

    /* 2 ô nhỏ lại trên mobile nhỏ */
    .starlink-usage-stats .stat-card {
        padding: 12px;
    }

    .starlink-usage-stats .stat-value {
        font-size: 16px;
    }

    .starlink-usage-stats .stat-icon {
        width: 36px;
        height: 36px;
    }

    /* Tăng chiều cao chart */
    .starlink-chart-wrapper {
        min-height: 400px;
    }

    .starlink-chart-wrapper canvas {
        min-height: 350px !important;
        height: 350px !important;
    }
}