/* Odoo Manager - Styles */
/* Author: Biruk Ephrem */

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

:root {
    --primary: #714B67;
    --primary-dark: #5a3c52;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --gray: #6c757d;
    --light: #f8f9fa;
    --dark: #343a40;
    --bg: #f5f5f5;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--dark);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: var(--primary);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.5rem;
}

nav a {
    color: white;
    text-decoration: none;
    margin-left: 1.5rem;
    opacity: 0.9;
}

nav a:hover {
    opacity: 1;
}

nav a.active {
    font-weight: bold;
    border-bottom: 2px solid white;
    padding-bottom: 2px;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    margin-bottom: 1rem;
    color: var(--primary);
    font-size: 1.25rem;
}

/* Status */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-running {
    background: #d4edda;
    color: #155724;
}

.status-stopped {
    background: #f8d7da;
    color: #721c24;
}

.status-failed {
    background: #f8d7da;
    color: #721c24;
}

.status-unknown {
    background: #e2e3e5;
    color: #383d41;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    text-decoration: none;
    transition: background 0.2s;
}

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

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

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

.btn-success:hover {
    background: #218838;
}

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

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

.btn-warning {
    background: var(--warning);
    color: var(--dark);
}

.btn-warning:hover {
    background: #e0a800;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(113, 75, 103, 0.2);
}

select.form-control {
    cursor: pointer;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.login-box .btn {
    width: 100%;
    padding: 0.75rem;
}

/* Logs */
.log-viewer {
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    padding: 1rem;
    border-radius: 4px;
    max-height: 500px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.log-viewer .log-line {
    padding: 2px 0;
    border-bottom: 1px solid #333;
}

.log-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.log-controls select,
.log-controls input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Status Card */
.status-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.status-item {
    padding: 1rem;
    background: var(--light);
    border-radius: 4px;
}

.status-item label {
    font-size: 0.875rem;
    color: var(--gray);
    display: block;
    margin-bottom: 0.25rem;
}

.status-item .value {
    font-size: 1.25rem;
    font-weight: 500;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

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

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

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

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header h2 {
    margin-bottom: 0;
}

/* Services Table */
.services-table {
    width: 100%;
    border-collapse: collapse;
}

.services-table th,
.services-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.services-table th {
    background: var(--light);
    font-weight: 600;
    color: var(--gray);
    font-size: 0.875rem;
    text-transform: uppercase;
}

.services-table tr:hover {
    background: #fafafa;
}

.services-table .actions {
    white-space: nowrap;
}

.services-table .actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    margin-right: 0.25rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-icon {
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: 1px solid #ddd;
    color: var(--gray);
}

.btn-icon:hover {
    background: var(--light);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    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: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    margin: 0;
    color: var(--primary);
}

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

.modal-close:hover {
    color: var(--dark);
}

.modal-content form {
    padding: 1.5rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray);
}

.empty-state p {
    margin-bottom: 1rem;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--gray);
}

/* Responsive - Tablet */
@media (max-width: 992px) {
    .container {
        padding: 15px;
    }

    .services-table th:nth-child(5),
    .services-table td:nth-child(5),
    .services-table th:nth-child(6),
    .services-table td:nth-child(6) {
        display: none; /* Hide CPU and Memory on tablet */
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    header {
        padding: 0.75rem 0;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    header .container {
        flex-direction: column;
        gap: 0.75rem;
        padding: 10px 15px;
    }

    header h1 {
        font-size: 1.25rem;
    }

    nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    nav a {
        margin: 0;
        padding: 0.4rem 0.7rem;
        background: rgba(255,255,255,0.15);
        border-radius: 4px;
        font-size: 0.85rem;
    }

    nav a.active {
        background: rgba(255,255,255,0.25);
        border-bottom: none;
    }

    .container {
        padding: 10px;
    }

    .card {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 6px;
    }

    .card h2 {
        font-size: 1.1rem;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .card-header .btn {
        width: 100%;
    }

    /* Services - Card Layout on Mobile */
    .services-table {
        display: block;
    }

    .services-table thead {
        display: none;
    }

    .services-table tbody {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .services-table tr {
        display: block;
        background: var(--light);
        border-radius: 8px;
        padding: 1rem;
        border: 1px solid #eee;
    }

    .services-table tr:hover {
        background: var(--light);
    }

    .services-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.4rem 0;
        border-bottom: 1px solid #e0e0e0;
    }

    .services-table td:last-child {
        border-bottom: none;
        padding-top: 0.75rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .services-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--gray);
        font-size: 0.8rem;
        text-transform: uppercase;
    }

    .services-table td:first-child {
        flex-direction: column;
        align-items: flex-start;
    }

    .services-table td:first-child::before {
        display: none;
    }

    .services-table td:first-child strong {
        font-size: 1.1rem;
        color: var(--primary);
    }

    .services-table .actions {
        justify-content: flex-start;
        white-space: normal;
    }

    .services-table .actions .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Buttons */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .btn-sm {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-group .btn {
        width: 100%;
    }

    /* Forms */
    .form-control {
        padding: 0.65rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    select.form-control {
        font-size: 16px;
    }

    /* Modal */
    .modal {
        align-items: flex-end;
        padding: 0;
    }

    .modal-content {
        margin: 0;
        border-radius: 16px 16px 0 0;
        max-height: 85vh;
        width: 100%;
        max-width: 100%;
    }

    .modal-header {
        padding: 1rem;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
    }

    .modal-content form {
        padding: 1rem;
    }

    .form-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .form-actions .btn {
        width: 100%;
        padding: 0.75rem;
    }

    /* Logs */
    .log-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .log-controls select,
    .log-controls input {
        width: 100%;
        padding: 0.65rem;
        font-size: 16px;
    }

    .log-controls .btn {
        width: 100%;
    }

    .log-viewer {
        font-size: 0.75rem;
        max-height: 400px;
        padding: 0.75rem;
    }

    /* Login */
    .login-container {
        padding: 1rem;
    }

    .login-box {
        padding: 1.5rem;
        border-radius: 12px;
    }

    .login-box h1 {
        font-size: 1.5rem;
    }

    /* Alerts */
    .alert {
        padding: 0.75rem;
        font-size: 0.9rem;
        border-radius: 6px;
    }

    /* Empty state */
    .empty-state {
        padding: 2rem 1rem;
    }

    /* Settings page user management grid */
    #add-user-form > div {
        grid-template-columns: 1fr !important;
    }

    /* Feedback button */
    #feedback-btn {
        bottom: 15px !important;
        right: 15px !important;
        width: 45px !important;
        height: 45px !important;
        font-size: 20px !important;
    }
}

/* Extra small devices */
@media (max-width: 400px) {
    nav {
        gap: 0.3rem;
    }

    nav a {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
    }

    .services-table .actions .btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.7rem;
    }

    .card {
        padding: 0.75rem;
    }
}
