/**
 * Marketing System - Professional Theme
 */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: #f4f6f8;
}

a { color: #0066cc; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app-container { display: flex; min-height: 100vh; }
.main-content { flex: 1; margin-left: 240px; padding: 30px; }
.content-wrapper { max-width: 1400px; }

@media (max-width: 768px) {
    .main-content { margin-left: 0; padding: 20px; }
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: #1e2a38;
    color: #fff;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.user-info { font-size: 13px; color: rgba(255,255,255,0.6); }

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 10px;
    text-transform: uppercase;
    margin-left: 8px;
    background: rgba(255,255,255,0.15);
}
.role-badge.admin { background: #c0392b; }

.nav-menu { list-style: none; padding: 15px 0; flex: 1; }

.nav-section {
    padding: 18px 20px 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.35);
    font-weight: 600;
}

.nav-menu li a {
    display: block;
    padding: 10px 20px;
    color: rgba(255,255,255,0.75);
    font-size: 14px;
    transition: all 0.15s;
}

.nav-menu li a:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
    text-decoration: none;
}

.nav-menu li a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-left: 3px solid #3498db;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.logout-btn {
    display: block;
    padding: 10px 15px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    text-align: center;
    border-radius: 4px;
}
.logout-btn:hover { background: rgba(255,255,255,0.12); text-decoration: none; }

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.page-header h1 { font-size: 22px; font-weight: 600; color: #1e2a38; }

/* Search Bar */
.search-bar {
    background: #fff;
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #e1e5e9;
}

/* Cards */
.card {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 20px;
    border: 1px solid #e1e5e9;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background: #fafbfc;
}

.card-header h2, .card-header h3 { font-size: 15px; font-weight: 600; color: #333; }
.card-body { padding: 20px; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: #fff;
    border-radius: 4px;
    padding: 20px;
    border: 1px solid #e1e5e9;
    border-left: 4px solid #1e2a38;
}

.stat-card.info { border-left-color: #3498db; }
.stat-card.success { border-left-color: #27ae60; }
.stat-card.warning { border-left-color: #f39c12; }
.stat-card.danger { border-left-color: #c0392b; }

.stat-value { font-size: 28px; font-weight: 700; color: #1e2a38; }
.stat-label { font-size: 13px; color: #666; margin-top: 4px; }

/* Tables */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #eee; }
th {
    font-weight: 600;
    color: #555;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: #f8f9fa;
}
tr:hover { background: #f9fafb; }
.text-muted { color: #888; font-size: 12px; }

.action-buttons { display: flex; gap: 5px; flex-wrap: wrap; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.4;
}
.btn:hover { text-decoration: none; }

.btn-primary { background: #3498db; color: #fff; }
.btn-primary:hover { background: #2980b9; }

.btn-secondary { background: #6c757d; color: #fff; }
.btn-secondary:hover { background: #5a6268; }

.btn-success { background: #27ae60; color: #fff; }
.btn-success:hover { background: #219a52; }

.btn-warning { background: #f39c12; color: #fff; }
.btn-warning:hover { background: #d68910; }

.btn-danger { background: #c0392b; color: #fff; }
.btn-danger:hover { background: #a93226; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; width: 100%; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
    color: #444;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 500px) {
    .form-row { grid-template-columns: 1fr; }
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Alerts */
.alert { padding: 14px 18px; border-radius: 4px; margin-bottom: 20px; font-size: 14px; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-radius: 3px;
}

.badge-success, .badge-approved, .badge-active, .badge-accepted, .badge-published { background: #d4edda; color: #155724; }
.badge-warning, .badge-pending, .badge-submitted, .badge-draft, .badge-planned { background: #fff3cd; color: #856404; }
.badge-danger, .badge-rejected, .badge-inactive, .badge-declined { background: #f8d7da; color: #721c24; }
.badge-info, .badge-open, .badge-revision_requested { background: #d1ecf1; color: #0c5460; }
.badge-secondary, .badge-closed, .badge-paused, .badge-completed, .badge-in_production { background: #e9ecef; color: #495057; }

/* Modals - stöd för både .modal och .modal-overlay */
.modal,
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active,
.modal-overlay.active {
    display: flex;
}

.modal-overlay > .modal {
    position: relative;
    display: block;
    background: #fff;
    border-radius: 6px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.modal-content {
    background: #fff;
    border-radius: 6px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.modal-lg,
.modal-lg .modal,
.modal-lg.modal-content { max-width: 700px; }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid #eee;
}
.modal-header h2,
.modal-header h3 { font-size: 17px; font-weight: 600; margin: 0; }

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.modal-close:hover { color: #333; }

.modal-body { padding: 20px; }

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 15px 20px;
    border-top: 1px solid #eee;
    background: #fafbfc;
}

/* Login & Register */
.login-container, .register-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f6f8;
    padding: 20px;
}

.login-box, .register-box {
    background: #fff;
    padding: 40px;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 400px;
    border: 1px solid #e1e5e9;
}

.register-box { max-width: 500px; }

.login-box h1, .register-box h1 {
    font-size: 22px;
    margin-bottom: 25px;
    text-align: center;
    color: #1e2a38;
}

.register-box .subtitle { color: #666; margin-bottom: 30px; text-align: center; }

.back-link { display: block; text-align: center; margin-top: 25px; color: #666; }
.required { color: #c0392b; }

/* Empty State */
.empty-state { text-align: center; padding: 50px 20px; color: #888; }
.empty-state p { margin-bottom: 15px; }

/* Tabs */
.tabs { display: flex; border-bottom: 2px solid #e0e0e0; margin-bottom: 25px; }
.tab {
    padding: 12px 20px;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-weight: 500;
}
.tab:hover { color: #333; text-decoration: none; }
.tab.active { color: #3498db; border-bottom-color: #3498db; }
.tab .badge { margin-left: 8px; }

/* Detail Grid */
.detail-grid { display: grid; gap: 12px; }
.detail-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { font-weight: 600; color: #666; font-size: 13px; }

/* Invitation Cards */
.invitation-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 20px; }
.invitation-card { border: 1px solid #e0e0e0; border-radius: 6px; padding: 20px; background: #fff; }
.invitation-card.pending { border-color: #f39c12; background: #fffdf8; }
.invitation-card .inv-header { display: flex; justify-content: space-between; margin-bottom: 15px; }
.invitation-card h3 { font-size: 16px; font-weight: 600; }
.inv-type { background: #1e2a38; color: #fff; padding: 3px 10px; border-radius: 3px; font-size: 11px; text-transform: uppercase; }
.inv-description { color: #666; margin-bottom: 15px; font-size: 14px; }
.inv-details { background: #f8f9fa; border-radius: 4px; padding: 15px; margin-bottom: 15px; }
.inv-detail { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #eee; font-size: 13px; }
.inv-detail:last-child { border-bottom: none; }
.inv-detail .label { color: #666; }
.inv-detail .value { font-weight: 600; }
.inv-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Utilities */
.text-center { text-align: center; }
.text-success { color: #27ae60; }
.text-danger { color: #c0392b; }
.text-warning { color: #f39c12; }