/* PDFModule Dashboard Styles */

/* Variables */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #ca8a04;
    --danger: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 240px;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-800);
    background-color: var(--gray-50);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-700);
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: white;
    text-decoration: none;
}

.logo:hover {
    text-decoration: none;
}

.sidebar-nav {
    flex: 1;
    list-style: none;
    margin: 0;
    padding: 10px 0;
}

.sidebar-nav li a {
    display: block;
    padding: 12px 20px;
    color: var(--gray-300);
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}

.sidebar-nav li a:hover {
    background: var(--gray-800);
    color: white;
}

.sidebar-nav li a.active {
    background: var(--primary);
    color: white;
}

.sidebar-nav li.sidebar-divider {
    height: 1px;
    background: var(--gray-700);
    margin: 10px 20px;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--gray-700);
}

.user-info {
    margin-bottom: 10px;
}

.user-email {
    display: block;
    font-size: 13px;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-plan {
    display: inline-block;
    font-size: 11px;
    color: var(--gray-400);
    background: var(--gray-700);
    padding: 2px 8px;
    border-radius: 3px;
    margin-top: 5px;
}

.main-content {
    flex: 1;
    padding: 30px;
}

.main-content.with-sidebar {
    margin-left: var(--sidebar-width);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn:hover {
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: white;
    border-color: var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

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

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

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

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--gray-500);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-section {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.form-section h2 {
    margin: 0 0 20px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.code-editor {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 13px;
}

.inline-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.inline-form .form-group {
    margin-bottom: 0;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

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

.alert-warning {
    background: #fefce8;
    color: #854d0e;
    border: 1px solid #fef08a;
}

.alert ul {
    margin: 5px 0 0 0;
    padding-left: 20px;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--gray-600);
}

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

.table tbody tr:hover {
    background: var(--gray-50);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge-rendered,
.badge-live {
    background: #dcfce7;
    color: #166534;
}

.badge-pending,
.badge-test {
    background: #fef3c7;
    color: #92400e;
}

.badge-failed {
    background: #fef2f2;
    color: #991b1b;
}

.badge-locked {
    background: var(--gray-200);
    color: var(--gray-600);
}

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

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 20px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-label {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 5px;
}

.stat-bar {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
}

/* Sections */
.section {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

/* Quick Start */
.quick-start {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.quick-start-step {
    text-align: center;
    padding: 20px;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    font-size: 18px;
    font-weight: 700;
    border-radius: 50%;
    margin-bottom: 15px;
}

.quick-start-step h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.quick-start-step p {
    margin: 0 0 15px 0;
    color: var(--gray-600);
    font-size: 13px;
}

/* Templates Grid */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.template-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
}

.template-card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.template-card-header h3 {
    margin: 0;
    font-size: 16px;
}

.template-card-body {
    padding: 15px 20px;
}

.template-description {
    margin: 0 0 15px 0;
    color: var(--gray-600);
    font-size: 13px;
}

.template-meta {
    font-size: 12px;
    color: var(--gray-500);
}

.meta-item {
    display: block;
    margin-bottom: 3px;
}

.template-card-footer {
    padding: 15px 20px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.template-slug {
    font-size: 12px;
    color: var(--gray-500);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
}

.empty-state h3 {
    margin: 0 0 10px 0;
    color: var(--gray-700);
}

.empty-state p {
    margin: 0 0 20px 0;
    color: var(--gray-500);
}

/* Auth Container */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-box {
    width: 100%;
    max-width: 400px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 40px;
}

.auth-box h1 {
    margin: 0 0 5px 0;
    font-size: 24px;
    text-align: center;
}

.auth-subtitle {
    text-align: center;
    color: var(--gray-500);
    margin: 0 0 30px 0;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--gray-600);
}

.auth-terms {
    text-align: center;
    margin-top: 20px;
    color: var(--gray-500);
}

/* Modal */
.modal {
    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;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    overflow: auto;
}

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

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-500);
}

.modal-body {
    padding: 20px;
}

.modal-body pre {
    background: var(--gray-900);
    color: var(--gray-100);
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 13px;
}

/* Document Details */
.document-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.detail-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 20px;
}

.detail-card h2 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
}

.detail-card.error {
    background: #fef2f2;
    border-color: #fecaca;
}

.detail-card.warning {
    background: #fefce8;
    border-color: #fef08a;
}

.detail-list {
    margin: 0;
}

.detail-list dt {
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 3px;
}

.detail-list dd {
    margin: 0 0 15px 0;
    font-weight: 500;
}

.detail-list dd:last-child {
    margin-bottom: 0;
}

.detail-list code.hash {
    font-size: 11px;
    word-break: break-all;
}

.detail-actions {
    grid-column: 1 / -1;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.pagination-info {
    color: var(--gray-500);
}

/* API Key Display */
.api-key-display {
    display: block;
    margin: 10px 0;
    padding: 10px;
    background: var(--gray-900);
    color: #fff;
    border-radius: 4px;
    font-size: 13px;
    word-break: break-all;
}

/* Plan Info */
.plan-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.plan-current {
    padding: 20px;
    background: var(--gray-50);
    border-radius: 8px;
}

.plan-name {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
}

.plan-usage {
    display: block;
    margin-top: 5px;
    color: var(--gray-600);
}

.plan-limits h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
}

.plan-limits ul {
    margin: 0;
    padding-left: 20px;
    color: var(--gray-600);
}

.plan-limits li {
    margin-bottom: 5px;
}

/* Template Help */
.template-help {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 20px;
    margin-top: 30px;
}

.template-help h3 {
    margin: 0 0 15px 0;
    font-size: 14px;
}

/* Code */
code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 13px;
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 3px;
}

/* Settings Form */
.settings-form {
    max-width: 600px;
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.mb-0 { margin-bottom: 0; }
.mt-20 { margin-top: 20px; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content.with-sidebar {
        margin-left: 0;
    }

    .quick-start {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .plan-info {
        grid-template-columns: 1fr;
    }
}
