:root {
    --primary: #232f3e;
    --secondary: #ff9900;
    --bg-color: #f2f4f8;
    --surface: #ffffff;
    --text-main: #16191f;
    --text-light: #545b64;
    --success: #1d8102;
    --danger: #d13212;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
}

.aws-header {
    background-color: var(--primary);
    color: white;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    height: 60px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.service-name {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.header-nav {
    display: flex;
    gap: 5px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: #aab7b8;
    cursor: pointer;
    padding: 8px 15px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    transition: 0.3s;
}

.nav-btn:hover, .nav-btn.active {
    color: white;
    background-color: rgba(255,255,255,0.1);
}

.main-content {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

/* Home Section */
.hero-content {
    text-align: center;
    margin-bottom: 40px;
}

.upload-card {
    background: var(--surface);
    border-radius: 8px;
    padding: 30px;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #eaeded;
}

.upload-zone {
    border: 2px dashed #d5dbdb;
    border-radius: 6px;
    padding: 40px 20px;
    cursor: pointer;
    transition: 0.3s;
    background: #fafafa;
}

.upload-zone:hover {
    border-color: var(--secondary);
    background: #fff;
}

.upload-icon {
    font-size: 48px;
    color: #879596;
}

/* Detection Section */
.detection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.preview-card, .analysis-card {
    background: var(--surface);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    min-height: 400px;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #eaeded;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.media-preview {
    width: 100%;
    height: 300px;
    background: #000;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.media-preview img, .media-preview video {
    max-width: 100%;
    max-height: 100%;
}

.empty-state {
    color: #fff;
    text-align: center;
}

/* Results & Loaders */
.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--secondary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

.result-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    margin-bottom: 20px;
}

.result-icon.fake { color: var(--danger); }
.result-icon.real { color: var(--success); }

/* Heatmap Gallery inside Results */
.heatmap-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}
.heatmap-card img {
    width: 100%;
    border-radius: 4px;
    border: 1px solid #eaeded;
}

/* Dashboard Section */
.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.page-title {
    font-size: 32px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: var(--text-main);
}

.page-subtitle {
    font-size: 16px;
    color: var(--text-light);
    margin: 0;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: var(--surface);
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #eaeded;
    display: flex;
    align-items: center;
    gap: 20px;
}

.metric-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.metric-icon.accuracy {
    background: var(--danger);
}

.metric-icon.speed {
    background: #3498db;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 5px;
}

.metric-label {
    font-size: 14px;
    color: var(--text-light);
}

.chart-card {
    background: var(--surface);
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #eaeded;
}

.chart-card .card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #eaeded;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.clear-history-btn {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #fef2f0;
    border: 1px solid #fccfcf;
    border-radius: 6px;
    color: var(--danger);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-history-btn:hover {
    background: #fde8e5;
    border-color: var(--danger);
}

.clear-history-btn .material-icons {
    font-size: 16px;
}

/* History Table */
.history-table-wrapper {
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

.history-table-wrapper::-webkit-scrollbar {
    width: 6px;
}

.history-table-wrapper::-webkit-scrollbar-thumb {
    background: #d5dbdb;
    border-radius: 3px;
}

.history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    font-size: 13px;
}

.history-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.history-table th {
    background: var(--primary);
    color: #fff;
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.history-table th:first-child {
    border-radius: 8px 0 0 8px;
}

.history-table th:last-child {
    border-radius: 0 8px 8px 0;
}

.history-table td {
    padding: 14px 14px;
    background: var(--surface);
    color: var(--text-main);
    vertical-align: middle;
}

.history-table tbody tr td:first-child {
    border-radius: 8px 0 0 8px;
}

.history-table tbody tr td:last-child {
    border-radius: 0 8px 8px 0;
}

.history-table tbody tr {
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.2s ease;
}

.history-table tbody tr:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.history-table .row-number {
    font-weight: 700;
    color: var(--text-light);
    font-size: 12px;
    width: 40px;
}

.history-table .file-name {
    font-weight: 500;
    color: var(--text-main);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-table .verdict-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.verdict-badge.fake {
    background: linear-gradient(135deg, #fef2f0, #fde8e5);
    color: var(--danger);
    border: 1px solid #fccfcf;
}

.verdict-badge.real {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    color: var(--success);
    border: 1px solid #a5d6a7;
}

.verdict-badge .material-icons {
    font-size: 14px;
}

.history-table .type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 500;
}

.type-badge.audio {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}

.type-badge.video {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.type-badge.image {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #ce93d8;
}

.type-badge .material-icons {
    font-size: 14px;
}

.history-table .confidence-cell {
    font-weight: 600;
    font-size: 13px;
}

.history-table .time-cell {
    color: var(--text-light);
    font-size: 12px;
}

.history-table .date-cell {
    color: var(--text-light);
    font-size: 11px;
    white-space: nowrap;
}

.empty-history {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-history .material-icons {
    font-size: 56px;
    color: #d5dbdb;
    display: block;
    margin-bottom: 14px;
}

.empty-history p {
    font-size: 15px;
    line-height: 1.5;
}

/* About Section */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
}

.feature-card {
    background: var(--surface);
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #eaeded;
    text-align: center;
    transition: transform 0.3s ease;
}

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

.feature-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary), #ffb84d);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
}

.feature-card h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: var(--text-main);
}

.feature-card p {
    color: var(--text-light);
    line-height: 1.6;
    margin: 0;
}

/* Team Section */
.team-section {
    margin-top: 60px;
}

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

.team-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 30px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #eaeded;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.team-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.team-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 48px;
    font-weight: 600;
    border: 4px solid #f8f9fa;
}

.team-name {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--text-main);
}

.team-role {
    font-size: 16px;
    color: var(--secondary);
    font-weight: 500;
    margin: 0 0 15px 0;
}

.team-bio {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.5;
    margin: 0;
}

/* Confidence Bar */
.confidence-section {
    margin: 20px 0;
}

.confidence-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.confidence-bar {
    height: 8px;
    background: #eaeded;
    border-radius: 4px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--secondary));
    transition: width 0.5s ease;
}

/* Progress Bar */
.progress-wrapper {
    margin-bottom: 20px;
}

.progress-bar {
    height: 6px;
    background: #eaeded;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: var(--secondary);
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

.progress-text {
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
}

/* Modals */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); align-items: center; justify-content: center; }
.modal-card { background: white; padding: 20px; border-radius: 8px; width: 400px; }
.modal-header { display: flex; justify-content: space-between; }
.modal-close { background: none; border: none; cursor: pointer; }


/* ========================================
   RESPONSIVE DESIGN - Mobile & Tablet
   ======================================== */

/* Tablet (768px and below) */
@media screen and (max-width: 768px) {
    .header-container {
        flex-direction: column;
        height: auto;
        padding: 12px 0;
        gap: 10px;
    }

    .service-name {
        font-size: 15px;
    }

    .header-nav {
        width: 100%;
        justify-content: center;
        gap: 2px;
    }

    .nav-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .nav-btn span:last-child {
        display: none;
    }

    .main-content {
        margin: 20px auto;
        padding: 0 12px;
    }

    .page-title {
        font-size: 24px;
    }

    .page-subtitle {
        font-size: 14px;
    }

    /* Detection Grid - Stack vertically */
    .detection-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .preview-card, .analysis-card {
        min-height: auto;
        padding: 15px;
    }

    .media-preview {
        height: 220px;
    }

    /* Metrics Grid */
    .metrics-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .metric-card {
        padding: 15px;
        gap: 12px;
    }

    .metric-icon {
        width: 45px;
        height: 45px;
    }

    .metric-icon .material-icons {
        font-size: 20px;
    }

    .metric-value {
        font-size: 22px;
    }

    .metric-label {
        font-size: 12px;
    }

    /* History Table */
    .chart-card {
        padding: 15px;
    }

    .history-table {
        font-size: 12px;
        border-spacing: 0 6px;
    }

    .history-table th {
        padding: 8px 8px;
        font-size: 10px;
    }

    .history-table td {
        padding: 10px 8px;
    }

    .history-table .file-name {
        max-width: 100px;
    }

    /* Hide less important columns on tablet */
    .history-table th:nth-child(6),
    .history-table td:nth-child(6) {
        display: none;
    }

    /* Feature Grid */
    .feature-grid {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .feature-card {
        padding: 20px;
    }

    /* Team Grid */
    .team-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .team-photo {
        width: 90px;
        height: 90px;
        font-size: 36px;
    }

    .team-name {
        font-size: 18px;
    }

    /* Upload Card */
    .upload-card {
        padding: 20px;
    }

    .upload-zone {
        padding: 30px 15px;
    }

    /* Heatmap Gallery */
    .heatmap-gallery {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    /* Modal */
    .modal-card {
        width: 90%;
        max-width: 350px;
    }
}

/* Mobile (480px and below) */
@media screen and (max-width: 480px) {
    .aws-header {
        padding: 0 10px;
    }

    .header-container {
        padding: 10px 0;
    }

    .header-left {
        gap: 6px;
    }

    .logo-icon {
        font-size: 20px;
    }

    .service-name {
        font-size: 13px;
    }

    .header-nav {
        gap: 0;
    }

    .nav-btn {
        padding: 6px 8px;
        font-size: 11px;
    }

    .main-content {
        margin: 15px auto;
        padding: 0 10px;
    }

    .page-title {
        font-size: 20px;
    }

    .page-subtitle {
        font-size: 13px;
    }

    .hero-title {
        font-size: 22px;
    }

    .hero-subtitle {
        font-size: 14px;
    }

    /* Upload */
    .upload-card {
        padding: 15px;
        border-radius: 6px;
    }

    .upload-zone {
        padding: 25px 10px;
    }

    .upload-icon {
        font-size: 36px;
    }

    .upload-text {
        font-size: 14px;
    }

    .upload-subtext {
        font-size: 11px;
    }

    /* Detection */
    .detection-grid {
        gap: 12px;
    }

    .preview-card, .analysis-card {
        padding: 12px;
    }

    .media-preview {
        height: 180px;
    }

    .result-status {
        font-size: 18px;
        gap: 8px;
    }

    .result-status h4 {
        font-size: 16px;
    }

    /* Metrics - Single column on small phones */
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .metric-card {
        padding: 14px;
        gap: 14px;
    }

    .metric-icon {
        width: 50px;
        height: 50px;
    }

    .metric-value {
        font-size: 24px;
    }

    /* History Table - Card layout on mobile */
    .history-table-wrapper {
        max-height: 400px;
    }

    .history-table {
        font-size: 11px;
        border-spacing: 0 5px;
    }

    .history-table th {
        padding: 6px 6px;
        font-size: 9px;
        letter-spacing: 0.3px;
    }

    .history-table td {
        padding: 8px 6px;
    }

    /* Hide time and date columns on mobile */
    .history-table th:nth-child(1),
    .history-table td:nth-child(1),
    .history-table th:nth-child(6),
    .history-table td:nth-child(6),
    .history-table th:nth-child(7),
    .history-table td:nth-child(7) {
        display: none;
    }

    .history-table .file-name {
        max-width: 70px;
        font-size: 11px;
    }

    .history-table .verdict-badge {
        padding: 3px 8px;
        font-size: 10px;
        gap: 3px;
    }

    .verdict-badge .material-icons {
        font-size: 12px;
    }

    .history-table .type-badge {
        padding: 3px 6px;
        font-size: 10px;
    }

    .type-badge .material-icons {
        font-size: 12px;
    }

    .clear-history-btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    /* Feature Grid - Single column */
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .feature-card {
        padding: 20px 15px;
    }

    .feature-icon {
        width: 60px;
        height: 60px;
    }

    .feature-card h3 {
        font-size: 17px;
    }

    .feature-card p {
        font-size: 13px;
    }

    /* Team Grid - Single column */
    .team-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .team-card {
        padding: 20px 15px;
    }

    .team-photo {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }

    .team-name {
        font-size: 17px;
    }

    .team-role {
        font-size: 14px;
    }

    .team-bio {
        font-size: 13px;
    }

    /* Heatmap Gallery - Single column */
    .heatmap-gallery {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    /* Confidence */
    .confidence-label {
        font-size: 12px;
    }

    /* Modal */
    .modal-card {
        width: 92%;
        padding: 15px;
    }

    .modal-card h3 {
        font-size: 16px;
    }

    .modal-card p {
        font-size: 13px;
    }
}

/* Small phones (360px and below) */
@media screen and (max-width: 360px) {
    .service-name {
        font-size: 11px;
    }

    .nav-btn .material-icons {
        font-size: 18px;
    }

    .page-title {
        font-size: 18px;
    }

    .upload-zone {
        padding: 20px 8px;
    }

    .media-preview {
        height: 150px;
    }

    .metrics-grid {
        gap: 8px;
    }

    .metric-card {
        padding: 12px;
    }

    .metric-value {
        font-size: 20px;
    }
}

/* Touch-friendly improvements for all mobile */
@media (hover: none) and (pointer: coarse) {
    .nav-btn {
        min-height: 44px;
        min-width: 44px;
    }

    .upload-zone {
        min-height: 120px;
    }

    .clear-history-btn {
        min-height: 36px;
        padding: 8px 12px;
    }

    .team-card:hover {
        transform: none;
    }

    .feature-card:hover {
        transform: none;
    }

    .history-table tbody tr:hover {
        transform: none;
    }
}
