* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-dark: #1e293b;
    --bg-light: #f8fafc;
    --text-dark: #0f172a;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 20px 60px rgba(0,0,0,0.15);
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--gradient);
    min-height: 100vh;
    line-height: 1.6;
}

/* ========== LOGIN PAGE ========== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-card {
    background: white;
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out;
}

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

.login-header {
    background: var(--gradient);
    color: white;
    padding: 50px 30px;
    text-align: center;
}

.logo {
    font-size: 4rem;
    margin-bottom: 20px;
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.login-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    opacity: 0.95;
    font-size: 1.1rem;
}

.login-body {
    padding: 40px 30px;
}

.welcome-text {
    color: var(--text-light);
    margin-bottom: 30px;
    text-align: center;
    font-size: 1.05rem;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 16px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
}

.btn-google:hover {
    background: var(--bg-light);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.2);
}

.btn-google svg {
    flex-shrink: 0;
}

.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
}

.feature {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-light);
}

.feature .icon {
    display: block;
    font-size: 2rem;
    margin-bottom: 8px;
}

/* ========== DASHBOARD ========== */
.container {
    max-width: 1400px;
    margin: 20px auto;
    background: white;
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.dashboard-header {
    background: var(--gradient);
    color: white;
    padding: 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-title .logo {
    font-size: 3rem;
    animation: none;
}

.header-title h1 {
    font-size: 2rem;
    margin-bottom: 5px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255,255,255,0.15);
    padding: 10px 20px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 3px solid white;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-email {
    font-size: 0.85rem;
    opacity: 0.9;
}

.btn-logout {
    padding: 8px 20px;
    background: white;
    color: var(--primary);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: var(--bg-light);
    transform: translateY(-2px);
}

/* ========== CONTROLS ========== */
.controls {
    background: white;
    padding: 25px 30px;
    border-bottom: 2px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

select {
    padding: 12px 35px 12px 15px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

select:focus {
    outline: none;
    border-color: var(--primary);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-export {
    background: var(--success);
    color: white;
}

.btn-export:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3);
}

/* ========== STATS ========== */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 30px;
    background: linear-gradient(to bottom, var(--bg-light), white);
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.stat-card .number {
    font-size: 2.8rem;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card .label {
    color: var(--text-light);
    margin-top: 8px;
    font-weight: 500;
}

/* ========== TABLE ========== */
.table-container {
    padding: 30px;
    overflow-x: auto;
}

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

thead {
    background: var(--bg-dark);
    color: white;
}

th {
    padding: 18px 15px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: all 0.3s;
}

tbody tr:hover {
    background: var(--bg-light);
    transform: scale(1.005);
}

td {
    padding: 20px 15px;
}

.preview-cell {
    width: 120px;
}

.preview-img {
    width: 100px;
    height: 70px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.3s;
}

.preview-img:hover {
    transform: scale(1.6);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 10;
    position: relative;
}

.preview-loading {
    width: 100px;
    height: 70px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 10px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.project-name {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.project-meta {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 5px;
}

.badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-region {
    background: #dbeafe;
    color: #1e40af;
    margin-right: 5px;
}

.badge-power {
    background: #fef3c7;
    color: #92400e;
}

.btn-view {
    background: var(--primary);
    color: white;
    padding: 10px 24px;
    border-radius: 10px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-view:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.3);
}

/* ========== SPA VIEWER ========== */
#spa-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 1000;
    display: none;
}

#spa-container.active {
    display: flex;
    flex-direction: column;
}

.spa-header {
    background: var(--bg-dark);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.spa-header h2 {
    font-size: 1.3rem;
}

.btn-back {
    background: white;
    color: var(--bg-dark);
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-back:hover {
    background: var(--bg-light);
}

#spa-frame {
    flex: 1;
    border: none;
    width: 100%;
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state svg {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .header-title {
        flex-direction: column;
        text-align: center;
    }
    
    .header-title h1 {
        font-size: 1.5rem;
    }
    
    .user-menu {
        flex-direction: column;
        padding: 15px;
        border-radius: 16px;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .search-box {
        width: 100%;
    }
    
    select {
        width: 100%;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
    
    table {
        font-size: 0.9rem;
    }
    
    .preview-cell {
        display: none;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
}
