/* WebView Builder - Unified Minimal Design System */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    line-height: 1.6;
    color: #1a1a1a;
    background: #fafafa;
    font-weight: 400;
    letter-spacing: -0.01em;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: #0a0a0a;
    margin-bottom: 0.5rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p {
    margin-bottom: 1rem;
    color: #525252;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* Header & Navigation */
.header {
    background: #ffffff;
    border-bottom: 1px solid #e5e5e5;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.95);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0a0a0a;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: #525252;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: #f5f5f5;
    color: #0a0a0a;
}

.nav-link.active {
    background: #0a0a0a;
    color: #ffffff;
}

/* Mobile Menu */
.mobile-menu-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 1.125rem;
    cursor: pointer;
    padding: 0.5rem;
    color: #0a0a0a;
    position: relative;
    min-width: 40px;
    min-height: 40px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.2);
}

.mobile-menu-toggle i {
    display: inline-block;
}

.mobile-menu-toggle span {
    display: none !important;
}

/* Fallback when FontAwesome doesn't load */
.mobile-menu-toggle:not(.fas) span,
.mobile-menu-toggle i:empty + span {
    display: inline-block !important;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #ffffff;
        border-top: 1px solid #e5e5e5;
        flex-direction: column;
        gap: 0;
        padding: 1rem;
        display: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-link {
        width: 100%;
        justify-content: flex-start;
        padding: 0.75rem;
        border-radius: 6px;
    }
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #0a0a0a;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.page-description {
    color: #525252;
    font-size: 1rem;
    margin: 0;
}

/* Cards */
.card {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.card-header {
    border-bottom: 1px solid #f5f5f5;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0a0a0a;
    margin: 0;
}

/* Forms */
/* Form Elements - Standardized Sizing */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: #0a0a0a;
    font-size: 0.875rem;
}

.form-control,
.form-select,
.form-textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid #d4d4d4;
    border-radius: 6px;
    font-size: 0.9rem;
    background: #ffffff;
    color: #0a0a0a;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1.4;
    min-height: 40px;
    box-sizing: border-box;
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #0a0a0a;
    box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.05);
}

.form-control::placeholder,
input::placeholder,
textarea::placeholder {
    color: #a3a3a3;
    font-size: 0.9rem;
}

.form-textarea,
textarea {
    min-height: 80px;
    resize: vertical;
    padding: 0.625rem 0.75rem;
}

.form-select,
select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-right: 2.5rem;
    appearance: none;
    cursor: pointer;
}

/* Checkboxes and Radio Buttons */
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    min-height: auto;
    margin-right: 0.5rem;
    transform: scale(1.1);
}

/* File Inputs */
input[type="file"] {
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border: 1px dashed #d4d4d4;
    cursor: pointer;
}

input[type="file"]:focus {
    border-color: #0a0a0a;
    background: #f1f5f9;
}

.form-help {
    font-size: 0.8rem;
    color: #737373;
    margin-top: 0.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Buttons - Compatible with Form Elements */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1.4;
    min-height: 40px;
    box-sizing: border-box;
}

.btn-primary {
    background: #0a0a0a;
    color: #ffffff;
    border-color: #0a0a0a;
}

.btn-primary:hover {
    background: #262626;
    border-color: #262626;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #ffffff;
    color: #0a0a0a;
    border-color: #d4d4d4;
}

.btn-secondary:hover {
    background: #f5f5f5;
    border-color: #a3a3a3;
    transform: translateY(-1px);
}

.btn-danger {
    background: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
}

.btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    transform: translateY(-1px);
}

.btn-success {
    background: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
}

.btn-success:hover {
    background: #15803d;
    border-color: #15803d;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    min-height: 32px;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    min-height: 48px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn:disabled:hover {
    transform: none !important;
}

/* Download button specific styles */
.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.download-btn:hover {
    text-decoration: none;
    color: #ffffff;
}

.download-btn i {
    font-size: 0.9em;
}

/* Tables */
.table-container {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    background: #f9f9f9;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #0a0a0a;
    border-bottom: 1px solid #e5e5e5;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid #f5f5f5;
    color: #525252;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover {
    background: #fafafa;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.status-completed {
    background: #dcfce7;
    color: #166534;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-building {
    background: #dbeafe;
    color: #1e40af;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    border: 1px solid transparent;
}

.alert:empty {
    display: none !important;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-color: #fed7aa;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #0a0a0a;
    display: block;
    margin-bottom: 0.25rem;
}

.stat-label {
    color: #737373;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #737373;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #0a0a0a;
    margin-bottom: 0.5rem;
}

.empty-state-description {
    margin-bottom: 1.5rem;
}

/* Loading */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0a0a0a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* File Upload */
.file-upload {
    border: 2px dashed #d4d4d4;
    border-radius: 6px;
    padding: 2rem;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-upload:hover {
    border-color: #0a0a0a;
    background: #f5f5f5;
}

.file-upload input {
    display: none;
}

/* Color Input */
.color-input-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.color-input {
    width: 50px;
    height: 40px;
    border: 1px solid #d4d4d4;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    background: none;
    transition: all 0.2s ease;
}

.color-input:focus {
    outline: none;
    border-color: #0a0a0a;
    box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.05);
}

/* Card header responsive layout */
.card-header.d-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-header.d-flex .card-title {
    margin: 0;
}

@media (max-width: 768px) {
    .card-header.d-flex {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .card-header.d-flex .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .main-content {
        padding: 1rem 0;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .form-row {
        display: block;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .header-container {
        padding: 0.75rem 0.5rem;
    }
    
    .logo {
        font-size: 1.125rem;
    }
    
    .page-title {
        font-size: 1.375rem;
    }
    
    .card {
        padding: 0.75rem;
    }
}

/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mr-0 { margin-right: 0; }
.mr-1 { margin-right: 0.5rem; }
.mr-2 { margin-right: 1rem; }

.ml-0 { margin-left: 0; }
.ml-1 { margin-left: 0.5rem; }
.ml-2 { margin-left: 1rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

.select-none { user-select: none; }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* Focus styles */
*:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid #0a0a0a;
    outline-offset: 2px;
} 

/* Custom Popup/Modal Styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.popup-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(-10px);
    transition: all 0.3s ease;
    border: 1px solid #e5e5e5;
}

.popup-overlay.active .popup-content {
    transform: scale(1) translateY(0);
}

.popup-header {
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.popup-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0a0a0a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.popup-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: #ffffff;
}

.popup-icon.warning {
    background: #f59e0b;
}

.popup-icon.danger {
    background: #dc2626;
}

.popup-icon.success {
    background: #10b981;
}

.popup-icon.info {
    background: #3b82f6;
}

.popup-body {
    padding: 1rem 1.5rem;
}

.popup-message {
    color: #525252;
    line-height: 1.6;
    margin: 0;
    font-size: 0.9rem;
}

.popup-footer {
    padding: 1rem 1.5rem 1.5rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.popup-footer .btn {
    min-width: 80px;
}

/* Responsive */
@media (max-width: 480px) {
    .popup-content {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
    
    .popup-header,
    .popup-body,
    .popup-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .popup-footer {
        flex-direction: column-reverse;
    }
    
    .popup-footer .btn {
        width: 100%;
    }
} 