/* Event Invitation Admin Panel Styles */
/* Compatible with older browsers */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+Arabic:wght@400;500;600;700&display=swap');

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f6fa;
    color: #333;
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

[dir="rtl"] body {
    font-family: 'Noto Sans Arabic', 'Tahoma', Arial, sans-serif;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.25;
    color: #2c3e50;
    margin-bottom: 0.5em;
}

p {
    margin-bottom: 1em;
    line-height: 1.7;
}

a {
    color: #3498db;
}

a:hover {
    color: #2980b9;
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: #2c3e50;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-header {
    padding: 20px;
    background: #1a252f;
    border-bottom: 1px solid #34495e;
}

.sidebar-header h2 {
    font-size: 18px;
    margin: 0 0 5px 0;
}

.sidebar-header p {
    font-size: 12px;
    color: #95a5a6;
    margin: 0;
}

.sidebar-nav {
    padding: 15px 0;
}

.sidebar-nav a {
    display: block;
    padding: 12px 20px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    font-weight: 500;
    font-size: 14px;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: #34495e;
    color: white;
    border-left-color: #3498db;
}

.sidebar-nav a i {
    width: 20px;
    margin-right: 10px;
    text-align: center;
}

.sidebar-nav .logout-link {
    margin-top: 30px;
    border-top: 1px solid #34495e;
    color: #e74c3c;
}

.sidebar-nav .logout-link:hover {
    background: #c0392b;
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    min-height: 100vh;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.page-header h1 {
    font-size: 26px;
    color: #2c3e50;
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.page-header h1 i {
    color: #3498db;
    margin-right: 10px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

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

.btn-edit {
    background: #f39c12;
    color: white;
}

.btn-delete {
    background: #e74c3c;
    color: white;
}

.btn-view {
    background: #9b59b6;
    color: white;
}

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

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-close {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
}

/* Panels */
.panel {
    background: white;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 25px;
}

.panel-header {
    padding: 20px;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    margin: 0;
    font-size: 18px;
    color: #2c3e50;
}

.panel-body {
    padding: 20px;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 15px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
    font-size: 14px;
}

.table th {
    background: #f8f9fa;
    font-weight: 700;
    color: #2c3e50;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.table tr:hover {
    background: #f8f9fa;
}

.table-striped tbody tr:nth-child(even) {
    background: #f8f9fa;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    background: #ecf0f1;
    color: #2c3e50;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* Forms */
.form-section {
    background: white;
    padding: 25px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 25px;
}

.form-section h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 18px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    flex: 1;
    min-width: 0;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #555;
    font-size: 13px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="file"],
.form-group input[type="color"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.12);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #7f8c8d;
    font-size: 11px;
}

.required {
    color: #e74c3c;
}

.form-actions {
    display: flex;
    gap: 10px;
    padding: 20px 0;
}

/* Template Preview */
.template-thumb {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.pdf-preview {
    width: 80px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 4px;
}

.current-file {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.preview-img {
    max-width: 200px;
    max-height: 150px;
    margin-top: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Text Lines */
.text-lines-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.text-lines-section .section-header h3 {
    margin: 0;
}

.text-line-card {
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 15px;
    background: #fafafa;
}

.text-line-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.page-badge {
    background: #3498db;
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.font-badge {
    background: #9b59b6;
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
}

.text-line-actions {
    display: flex;
    gap: 5px;
}

.text-preview {
    font-size: 16px;
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-style: italic;
}

.text-line-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #7f8c8d;
}

.color-preview {
    display: inline-block;
    width: 15px;
    height: 15px;
    border: 1px solid #ddd;
    vertical-align: middle;
    border-radius: 2px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    overflow-y: auto;
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 0;
    border-radius: 5px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #7f8c8d;
}

.modal-close:hover {
    color: #2c3e50;
}

.modal form {
    padding: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid #ecf0f1;
}

/* Variables Panel */
.variables-panel {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.variables-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.variable-tag {
    display: inline-block;
    padding: 5px 12px;
    background: #3498db;
    color: white;
    border-radius: 20px;
    font-size: 12px;
    cursor: move;
    user-select: none;
}

.variable-tag:hover {
    background: #2980b9;
}

.drag-over {
    border-color: #3498db !important;
    background: #ebf5fb !important;
}

/* Preview Section */
.preview-section {
    margin-top: 30px;
}

.preview-controls {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.variables-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.variable-input {
    display: flex;
    flex-direction: column;
}

.variable-input label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
}

.variable-input input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.preview-container {
    background: white;
    padding: 20px;
    border-radius: 5px;
    text-align: center;
}

.preview-image-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.preview-base {
    max-width: 100%;
    height: auto;
}

.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.preview-placeholder {
    padding: 40px;
    color: #7f8c8d;
}

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

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.stat-info h3 {
    font-size: 32px;
    margin: 0;
    color: #2c3e50;
}

.stat-info p {
    margin: 0;
    color: #7f8c8d;
    font-size: 14px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

/* Activity List */
.activity-list {
    list-style: none;
    padding: 0;
}

.activity-list li {
    padding: 12px 0;
    border-bottom: 1px solid #ecf0f1;
}

.activity-list li:last-child {
    border-bottom: none;
}

.activity-action {
    font-weight: 600;
    color: #3498db;
}

.activity-time {
    float: right;
    color: #95a5a6;
    font-size: 12px;
}

.activity-list p {
    margin: 5px 0 0 0;
    font-size: 13px;
    color: #7f8c8d;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #95a5a6;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ecf0f1;
}

.page-info {
    color: #7f8c8d;
    font-size: 14px;
}

/* Actions */
.actions {
    white-space: nowrap;
}

.actions .btn {
    margin-right: 3px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }

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

    .admin-wrapper {
        flex-direction: column;
    }

    .form-row {
        flex-direction: column;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

/* Font Upload */
.font-upload-form {
    display: flex;
    align-items: flex-end;
    gap: 15px;
}

.font-upload-form .form-group {
    flex: 1;
}

/* Table Actions */
.actions {
    display: flex;
    gap: 5px;
}

.actions .btn-sm {
    padding: 5px 8px;
}

/* RTL overrides for Arabic */
[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    border-right: 3px solid transparent;
    border-left: none;
}

[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: 260px;
}

[dir="rtl"] .sidebar-nav a {
    border-left: none;
    border-right: 3px solid transparent;
}

[dir="rtl"] .sidebar-nav a:hover,
[dir="rtl"] .sidebar-nav a.active {
    border-right-color: #3498db;
    border-left-color: transparent;
}

[dir="rtl"] .sidebar-nav a i,
[dir="rtl"] .page-header h1 i {
    margin-right: 0;
    margin-left: 10px;
}

[dir="rtl"] .table th,
[dir="rtl"] .table td {
    text-align: right;
}

[dir="rtl"] .alert-close {
    right: auto;
    left: 15px;
}

[dir="rtl"] .modal-actions {
    justify-content: flex-start;
}

[dir="rtl"] .actions .btn {
    margin-right: 0;
    margin-left: 3px;
}

[dir="rtl"] .activity-time {
    float: left;
}

[dir="rtl"] .language-switcher .lang-form label {
    direction: rtl;
}

@media (max-width: 768px) {
    [dir="rtl"] .main-content {
        margin-right: 0;
    }
}
