/* Modern UI Variables & Reset */
:root {
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-1: #4f46e5;
    --accent-2: #ec4899;
    --success: #10b981;
    --error: #ef4444;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Prompt', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(79, 70, 229, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.15) 0%, transparent 50%);
    background-size: cover;
    background-attachment: fixed;
}

/* Navbar */
.navbar {
    width: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 400;
    transition: color 0.3s ease;
    padding: 0.5rem 0;
    position: relative;
}

.nav-link:hover {
    color: var(--text-main);
}

.nav-link.active {
    color: var(--text-main);
    font-weight: 500;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
    border-radius: 2px;
}

.app-container {
    width: 100%;
    max-width: 900px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 2rem;
}

.app-container.wide {
    max-width: 1200px;
}

/* Header */
.app-header {
    text-align: center;
    animation: fadeInDown 0.8s ease-out;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo h1 {
    font-size: 2.2rem;
    font-weight: 600;
    background: linear-gradient(135deg, #a5b4fc, #fbcfe8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .main-content.grid-layout {
        grid-template-columns: 2fr 1fr;
    }
}

/* Cards Glassmorphism */
.upload-card, .spec-card, .search-card, .table-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeIn 1s ease-out;
}

/* Dropzone */
.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    background: rgba(15, 23, 42, 0.4);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent-1);
    background: rgba(79, 70, 229, 0.1);
    transform: translateY(-2px);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.icon-container {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.2), rgba(236, 72, 153, 0.2));
    padding: 1.5rem;
    border-radius: 50%;
    margin-bottom: 0.5rem;
    color: #a5b4fc;
    transition: transform 0.3s ease;
}

.drop-zone:hover .icon-container {
    transform: scale(1.1);
}

.browse-btn {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
    border-radius: 999px;
    font-weight: 500;
    cursor: pointer;
    transition: box-shadow 0.3s ease, transform 0.2s ease;
    border: none;
    font-family: inherit;
    font-size: 1rem;
}

.browse-btn:hover {
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

.browse-btn:active {
    transform: translateY(1px);
}

/* Upload Progress Area */
.hidden {
    display: none !important;
}

.upload-progress {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--card-border);
    animation: slideUp 0.5s ease-out;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    background: rgba(0,0,0,0.2);
    padding: 1rem;
    border-radius: 12px;
}

.file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progress-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
    border-radius: 999px;
    transition: width 0.3s ease;
}

.status-message {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.status-error { color: var(--error); }
.status-success { color: var(--success); }

/* Specifications Card */
.spec-card h3 {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    color: #e2e8f0;
}

.col-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.col-list li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid transparent;
    transition: border-color 0.2s, background 0.2s;
}

.col-list li:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.col-idx {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 24px;
    height: 24px;
    background: rgba(79, 70, 229, 0.2);
    color: #a5b4fc;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Search Box */
.search-container {
    position: relative;
    width: 100%;
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Data Table */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.data-table th, .data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table th {
    background: rgba(15, 23, 42, 0.8);
    font-weight: 500;
    color: #a5b4fc;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table tbody tr {
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Empty State / Loading */
.table-message {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* Action Button & Badges */
.btn-sm {
    padding: 0.4rem 0.8rem;
    background: linear-gradient(135deg, var(--accent-1), #3b82f6);
    color: white;
    border-radius: 6px;
    font-weight: 400;
    cursor: pointer;
    border: none;
    font-family: inherit;
    font-size: 0.85rem;
    transition: transform 0.2s ease, opacity 0.2s;
}

.btn-sm:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.5rem;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid #10b981;
}

/* Modal Styling */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: #1e293b;
    border: 1px solid var(--card-border);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.hidden .modal-content {
    transform: scale(0.9);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-main);
    font-weight: 500;
}

.close-btn {
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover { color: white; }

.modal-body {
    padding: 1.5rem;
}

.modal-subtitle {
    margin-bottom: 1.5rem;
    color: #cbd5e1;
    font-weight: 500;
}

.options-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.radio-card {
    flex: 1;
    position: relative;
    cursor: pointer;
}

.radio-card input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.radio-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid var(--card-border);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.radio-card input:checked ~ .radio-content {
    border-color: var(--accent-1);
    background: rgba(79, 70, 229, 0.1);
}

.radio-icon {
    font-size: 1.5rem;
}

.proxy-fields {
    background: rgba(0,0,0,0.2);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255,255,255,0.05);
    animation: fadeInDown 0.3s ease-out;
}

.section-title {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #a5b4fc;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.text-input {
    padding: 0.6rem 0.8rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
}

.text-input:focus {
    outline: none;
    border-color: var(--accent-1);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
}

.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 500;
    transition: opacity 0.2s;
}

.btn:hover { opacity: 0.9; }

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--card-border);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: white;
    border: none;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #451a03;
    border: none;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 50;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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