/* CasaNova AutoPoster - Styles */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --facebook: #1877f2;
    --instagram: #e4405f;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border: #334155;
    --sidebar-width: 250px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
}

.hidden { display: none !important; }

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

.auth-box {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 10px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border);
}

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

.btn-facebook:hover {
    background: #1565d8;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

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

/* Auth Switch */
.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    border-right: 1px solid var(--border);
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
}

.sidebar-header i {
    color: var(--primary);
    font-size: 28px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover,
.nav-item.active {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
    border-right: 3px solid var(--primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

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

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    text-decoration: none;
}

.sidebar-footer a:hover {
    color: var(--danger);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
}

.section h2 {
    font-size: 28px;
    margin-bottom: 30px;
}

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

.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-card i {
    font-size: 32px;
    color: var(--primary);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 12px;
}

.stat-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Posts List */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.post-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    gap: 20px;
}

.post-card-content {
    flex: 1;
}

.post-card-content p {
    color: var(--text-secondary);
    margin-bottom: 10px;
    white-space: pre-wrap;
}

.post-card-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: var(--text-secondary);
}

.post-card-actions {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.post-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.post-status.scheduled { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.post-status.published { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.post-status.failed { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.post-status.draft { background: rgba(100, 116, 139, 0.2); color: var(--secondary); }

/* Create Post */
.create-post-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
}

.post-editor {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 30px;
}

.char-count {
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
}

.platform-checkboxes {
    display: flex;
    gap: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
}

.button-group {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

/* Post Preview */
.post-preview {
    position: sticky;
    top: 30px;
}

.post-preview h3 {
    margin-bottom: 15px;
}

.preview-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border-bottom: 1px solid var(--border);
}

.preview-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.preview-header strong {
    display: block;
}

.preview-header span {
    font-size: 12px;
    color: var(--text-secondary);
}

.preview-content {
    padding: 15px;
    white-space: pre-wrap;
    color: var(--text-secondary);
}

.preview-image img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
}

/* Templates */
.templates-header {
    margin-bottom: 20px;
}

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

.template-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
}

.template-card h4 {
    margin-bottom: 10px;
}

.template-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 15px;
    white-space: pre-wrap;
    max-height: 100px;
    overflow: hidden;
}

.template-card-actions {
    display: flex;
    gap: 10px;
}

/* Accounts */
.accounts-actions {
    margin-bottom: 30px;
}

.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.account-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.account-card i {
    font-size: 32px;
}

.account-card i.fa-facebook { color: var(--facebook); }
.account-card i.fa-instagram { color: var(--instagram); }

.account-info {
    flex: 1;
}

.account-info strong {
    display: block;
}

.account-info span {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

/* WordPress */
.wordpress-import {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    display: flex;
    gap: 20px;
    align-items: flex-end;
}

.wordpress-import .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

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

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.help-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 10px;
}

/* Toast */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--primary); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 1200px) {
    .create-post-container {
        grid-template-columns: 1fr;
    }
    .post-preview {
        position: static;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }
    .sidebar-header span,
    .nav-item span,
    .sidebar-footer span {
        display: none;
    }
    .main-content {
        margin-left: 70px;
    }
}
