/**
 * Form Generator Pro - Modern Styles
 * Clean, professional design with smooth animations
 */

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --secondary: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #64748b;
    --gray-light: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark);
    line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-4 {
    gap: 1rem;
}

.gap-6 {
    gap: 1.5rem;
}

.grid {
    display: grid;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* Navigation */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: var(--gray);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-links a:hover {
    color: var(--primary);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.nav-links a:hover::after {
    width: 100%;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.card-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-light);
}

.card-title {
    font-size: 1.5rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.card-subtitle {
    color: var(--gray);
    font-size: 0.95rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), #0891b2);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #0891b2, var(--secondary));
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(6, 182, 212, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--gray-light);
    color: var(--dark);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark);
}

.form-label span.required {
    color: var(--danger);
    margin-left: 4px;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: var(--transition);
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-control::placeholder {
    color: #94a3b8;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    padding-right: 3rem;
}

/* Input groups */
.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group .form-control {
    flex: 1;
}

/* Welcome Page */
.welcome-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem 4rem;
    text-align: center;
}

.hero-content {
    max-width: 800px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 1.5rem;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2.5rem;
    line-height: 1.8;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.features {
    background: white;
    padding: 4rem 2rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.feature-card {
    text-align: center;
    padding: 2rem;
}

.feature-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: white;
    font-size: 1.75rem;
}

.feature-title {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--dark);
}

.feature-desc {
    color: var(--gray);
    line-height: 1.6;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-logo {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.login-title {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.login-subtitle {
    color: var(--gray);
    margin-bottom: 2rem;
}

.login-form {
    text-align: left;
}

.login-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-light);
    text-align: center;
    color: var(--gray);
    font-size: 0.9rem;
}

.login-footer a {
    color: var(--primary);
    font-weight: 600;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* Alert Messages */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Dashboard */
.dashboard {
    padding-top: 80px;
    min-height: 100vh;
    background: #f1f5f9;
}

.dashboard-header {
    background: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--gray-light);
}

.dashboard-title {
    font-size: 1.875rem;
    color: var(--dark);
}

.dashboard-subtitle {
    color: var(--gray);
    margin-top: 0.25rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue {
    background: #dbeafe;
    color: #1e40af;
}

.stat-icon.green {
    background: #d1fae5;
    color: #065f46;
}

.stat-icon.purple {
    background: #e9d5ff;
    color: #7c3aed;
}

.stat-icon.orange {
    background: #ffedd5;
    color: #c2410c;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
}

.stat-label {
    color: var(--gray);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
}

.sidebar {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    height: fit-content;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 0.5rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--gray);
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: #eff6ff;
    color: var(--primary);
}

.sidebar-menu a i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.main-content {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    min-height: 500px;
}

/* File Upload */
.upload-zone {
    border: 3px dashed var(--gray-light);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background: #fafafa;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: #eff6ff;
}

.upload-zone:hover .upload-icon,
.upload-zone.dragover .upload-icon {
    color: var(--primary);
    transform: scale(1.1);
}

.upload-icon {
    font-size: 3rem;
    color: var(--gray);
    margin-bottom: 1rem;
    transition: var(--transition);
}

.upload-text {
    font-size: 1.125rem;
    color: var(--dark);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.upload-hint {
    color: var(--gray);
    font-size: 0.875rem;
}

.upload-input {
    display: none;
}

/* Form Builder */
.form-builder {
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    gap: 1.5rem;
    min-height: 600px;
}

.builder-sidebar {
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.builder-sidebar h4 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray);
    margin-bottom: 1rem;
}

.field-types {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.field-type {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-sm);
    cursor: grab;
    transition: var(--transition);
    font-size: 0.9rem;
}

.field-type:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.field-type i {
    color: var(--primary);
    width: 20px;
    text-align: center;
}

.builder-canvas {
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 2rem;
    border: 2px dashed var(--gray-light);
    min-height: 600px;
}

.builder-canvas.dragover {
    border-color: var(--primary);
    background: #eff6ff;
}

.form-preview {
    background: white;
    border-radius: var(--radius-sm);
    padding: 2rem;
    min-height: 100%;
    box-shadow: var(--shadow);
}

.form-preview h3 {
    text-align: center;
    padding: 2rem;
    color: var(--gray);
    border: 2px dashed var(--gray-light);
    border-radius: var(--radius-sm);
}

.builder-properties {
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.builder-properties h4 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray);
    margin-bottom: 1rem;
}

/* Draggable Field */
.draggable-field {
    background: white;
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 1rem;
    cursor: move;
    transition: var(--transition);
    position: relative;
}

.draggable-field:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.draggable-field.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.field-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: var(--transition);
}

.draggable-field:hover .field-actions {
    opacity: 1;
}

.field-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.field-action-btn.edit {
    background: #dbeafe;
    color: #1e40af;
}

.field-action-btn.delete {
    background: #fee2e2;
    color: #991b1b;
}

.field-action-btn:hover {
    transform: scale(1.1);
}

/* Timer Display */
.timer-display {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--dark), #334155);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 1.25rem;
    font-weight: 700;
}

.timer-display.running {
    background: linear-gradient(135deg, var(--success), #059669);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.timer-controls {
    display: flex;
    gap: 0.5rem;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-light);
}

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

thead {
    background: #f8fafc;
}
th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-light);
}
th {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
tbody tr:hover {
    background: #f8fafc;
}
tbody tr:last-child td {
    border-bottom: none;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

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

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

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Modal */
.modal-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: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

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

.modal-title {
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: 60vh;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-light);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* A4 Preview */
.a4-preview {
    width: 210mm;
    min-height: 297mm;
    background: white;
    margin: 0 auto;
    padding: 20mm;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    position: relative;
}

.a4-preview::before {
    content: '';
    position: absolute;
    top: 10mm;
    left: 10mm;
    right: 10mm;
    bottom: 10mm;
    border: 1px solid #e2e8f0;
    pointer-events: none;
}

@media print {
    .a4-preview {
        width: 100%;
        padding: 10mm;
        box-shadow: none;
    }
    .no-print {
        display: none !important;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .form-builder {
        grid-template-columns: 1fr;
    }
    .builder-sidebar,
    .builder-properties {
        display: none;
    }
    .content-grid {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    .hero-subtitle {
        font-size: 1rem;
    }
    .nav-links {
        display: none;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .a4-preview {
        width: 100%;
        padding: 10mm;
    }
}

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

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: var(--dark);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Box Field Styles for Builder */
.box-preview {
    display: inline-block;
    vertical-align: top;
}

.box-preview.default {
    border: 2px solid #1e293b;
}

.box-preview.thin {
    border: 1px solid #1e293b;
}

.box-preview.thick {
    border: 3px solid #1e293b;
}

.box-preview.dashed {
    border: 2px dashed #1e293b;
}

.box-preview.double {
    border: 4px double #1e293b;
}

/* Builder Table Preview */
.builder-table-preview {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid #1e293b;
    margin-top: 10px;
}

.builder-table-preview th,
.builder-table-preview td {
    border: 1px solid #1e293b;
    padding: 8px;
    text-align: center;
    font-size: 0.8rem;
}

.builder-table-preview th {
    background: #f1f5f9;
    font-weight: 600;
}

/* Form Group in Properties */
.builder-properties .form-group {
    margin-bottom: 15px;
}

.builder-properties .form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #374151;
}

.builder-properties .form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.builder-properties .form-control:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.builder-properties textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Text utilities */
.text-gray-500 {
    color: #6b7280;
}

.mt-2 {
    margin-top: 0.5rem;
}

/* Alert animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
