@charset "UTF-8";

@font-face {
    font-family: 'IRANYekanXVF';
    src: url('../fonts/IRANYekanXVF.woff') format('woff-variations');
    font-weight: 100 1000;
    font-display: fallback;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #1d4ed8;
    --primary-dark: #1e40af;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border: #e2e8f0;
    --shadow: 0 10px 25px rgba(2, 6, 23, 0.08);
    --radius: 16px;
}

body {
    font-family: 'IRANYekanXVF', Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 24px;
    padding: 40px 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.login-logo {
    margin-bottom: 24px;
}

.login-logo svg {
    color: var(--primary);
}

.login-logo img {
    max-height: 80px;
}

.login-box h2 {
    margin-bottom: 24px;
    font-size: 24px;
    font-weight: 600;
}

.login-form .form-group {
    margin-bottom: 20px;
    text-align: right;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-login:hover {
    background: var(--primary-dark);
}

.alert {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #fee2e2;
    color: var(--danger);
    border-right: 4px solid var(--danger);
}

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    color: white;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);

    flex-direction: column;
    align-content: space-between;
    align-items: center;

}

.brand .logo-img {
    height: 66px;
    width: auto;
}

.brand svg {
    flex-shrink: 0;
}

.menu {
    flex: 1;
    padding: 20px 12px;
}

.menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 12px;
    margin-bottom: 6px;
    transition: all 0.2s;
}

.menu a svg {
    flex-shrink: 0;
}

.menu a:hover, .menu a.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.hint {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
}

.hint-title {
    font-weight: 600;
    margin-bottom: 8px;
}

.hint code {
    display: block;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-family: monospace;
    word-break: break-all;
    margin-top: 6px;
}

.user-info {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logout-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 12px;
}

.logout-link:hover {
    color: white;
}

.main {
    flex: 1;
    padding: 24px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.title {
    font-size: 22px;
    font-weight: 800;
}

/* Flash messages */
.flash {
    padding: 14px 18px;
    border-radius: 14px;
    margin-bottom: 20px;
    background: white;
    border-right: 4px solid;
    box-shadow: var(--shadow);
}

.flash.ok {
    border-color: var(--success);
}

.flash.err {
    border-color: var(--danger);
}

/* Forms Grid */
.forms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.form-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

.form-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 30px -12px rgba(0, 0, 0, 0.12);
}

.form-card.active {
    border-color: var(--primary);
    background: #eff6ff;
}

.form-card-header {
    margin-bottom: 16px;
}

.form-card-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}

.form-key {
    font-size: 12px;
    color: var(--muted);
    font-family: monospace;
}

.form-stats {
    font-size: 12px;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}

.form-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 6px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 12px;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-edit {
    background: var(--warning);
    color: white;
}

.btn-export {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-view {
    background: var(--muted);
    color: white;
}

.empty-forms {
    text-align: center;
    padding: 60px;
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.empty-forms p {
    margin-bottom: 20px;
    color: var(--muted);
}

/* Responses Section */
.responses-section {
    margin-top: 30px;
}

.responses-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.responses-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.search-form {
    display: flex;
    gap: 8px;
}

.search-form input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    width: 250px;
}

.search-form button {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.btn-clear {
    padding: 8px 16px;
    background: var(--muted);
    color: white;
    text-decoration: none;
    border-radius: 8px;
}

/* Table */
.table-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

thead th {
    text-align: right;
    padding: 14px 12px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    position: sticky;
    top: 0;
}

tbody td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    vertical-align: middle;
}

tbody tr:hover {
    background: #f8fafc;
}

.empty-state {
    text-align: center;
    padding: 48px !important;
    color: var(--muted);
}

/* Pagination */
.pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.pager-info {
    color: var(--muted);
    font-size: 13px;
}

.pager-links {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.pager-links a {
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
}

.pager-links a:hover {
    background: var(--bg);
    border-color: var(--primary);
}

.pager-links span {
    padding: 0 12px;
    color: var(--muted);
}

/* Form Container */
.form-container {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 600px;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    color: var(--muted);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn-submit {
    padding: 10px 24px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
}

.btn-cancel {
    padding: 10px 24px;
    background: var(--muted);
    color: white;
    border: none;
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
}

/* Info Box */
.info-box {
    background: #eff6ff;
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 20px;
}

.info-box h4 {
    margin-bottom: 12px;
    font-size: 16px;
}

.info-box code {
    display: block;
    background: #1e293b;
    color: #e2e8f0;
    padding: 10px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 12px;
    margin: 10px 0;
    word-break: break-all;
}

/* Detail Page */
.detail-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.detail-section {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.detail-section h4 {
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
}

.detail-table {
    width: 100%;
    min-width: auto;
}

.detail-table tr {
    border-bottom: 1px solid var(--border);
}

.detail-table th {
    width: 200px;
    text-align: right;
    padding: 12px;
    font-weight: 600;
    background: #f8fafc;
}

.detail-table td {
    padding: 12px;
}

.detail-actions {
    padding: 20px 24px;
    display: flex;
    gap: 12px;
    background: #f8fafc;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        transform: translateX(100%);
        transition: transform 0.3s;
        z-index: 100;
    }
    
    .main {
        padding: 16px;
    }
    
    .forms-grid {
        grid-template-columns: 1fr;
    }
    
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .responses-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-form {
        width: 100%;
    }
    
    .search-form input {
        flex: 1;
    }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.status-active {
    background: #dcfce7;
    color: #15803d;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.section-count {
    background: #e2e8f0;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: var(--muted);
}

.form-response-count .badge {
    background: #e2e8f0;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    color: var(--muted);
}

.response-total {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
    display: block;
}

.current-page {
    padding: 6px 12px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.brand {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand .logo-img {
    max-height: 111px;
    width: auto;
    margin-bottom: 12px;
}

.brand svg {
    margin-bottom: 12px;
    color: white;
}

.site-title {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
}

/* Help Box */
.help-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 24px;
    margin-bottom: 24px;
}

.help-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #bbf7d0;
}

.help-header svg {
    color: #15803d;
}

.help-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #15803d;
}

.help-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.step-number {
    width: 28px;
    height: 28px;
    background: #15803d;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
    color: #166534;
}

.step-content p {
    font-size: 13px;
    color: #4b5563;
    margin: 0;
    line-height: 1.5;
}

.help-note {
    background: #dcfce7;
    border-radius: 12px;
    padding: 12px 16px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #166534;
}

.help-note svg {
    flex-shrink: 0;
}

.info-box .mt-2 {
    margin-top: 12px;
}