/**
 * Secure OTP - Gemeinsame Styles
 * Farben basierend auf Hostcube Logo
 */

/* ==========================================================================
   Reset & Basis
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Helvetica, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #3b6295 0%, #2a3f5e 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Spezifisch für Login-Seite */
body.login-page {
    justify-content: center;
    align-items: center;
}

/* Spezifisch für logs.php - überschreibt body display */
body.logs-page {
    display: block;
}

/* Alerts in logs.php sollen sofort sichtbar sein */
body.logs-page .alert {
    display: block;
}

/* Container in logs.php breiter */
body.logs-page .container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header in logs.php als flexbox bar */
body.logs-page .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

/* ==========================================================================
   Container
   ========================================================================== */
.container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    padding: 40px;
}

.container.wide {
    max-width: 1400px;
    padding: 30px;
    margin: 0 auto;
}

/* ==========================================================================
   Header
   ========================================================================== */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.header.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    text-align: left;
}

.header .logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 20px;
}

.header h1 {
    color: #334e77;
    font-size: 28px;
    margin-bottom: 10px;
}

.header p {
    color: #666;
    font-size: 16px;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    padding: 14px;
    background: linear-gradient(135deg, #3b6295 0%, #2a3f5e 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(59, 98, 149, 0.4);
}

.btn:active {
    transform: translateY(0);
}

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

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

.btn.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: normal;
}

.btn-primary {
    background: #3b6295;
}

.btn-primary:hover {
    background: #334e77;
}

.btn-success {
    background: #28a745;
}

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

.btn-danger {
    background: #dc3545;
}

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

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-warning {
    background: #ff9800;
}

.btn-warning:hover {
    background: #fb8c00;
    box-shadow: 0 10px 20px rgba(255, 152, 0, 0.4);
}

.btn-link {
    background: none;
    border: none;
    color: #3b6295;
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
    padding: 5px 10px;
    transition: color 0.3s;
}

.btn-link:hover {
    color: #334e77;
    text-decoration: none;
    transform: none;
    box-shadow: none;
}

.btn-logout {
    background: #dc3545;
    padding: 8px 16px;
    font-size: 14px;
}

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

.btn-filter {
    background: #3b6295;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-filter:hover {
    background: #334e77;
}

.btn-reset {
    background: #6c757d;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    display: inline-block;
    border: none;
    cursor: pointer;
}

.btn-reset:hover {
    background: #5a6268;
}

.btn-delete {
    background: #dc3545;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

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

/* Copy Button */
.copy-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

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

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

/* Filter Section */
.filter-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.filter-group input[type="date"],
.filter-group input[type="text"] {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

.rate-limit-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.rate-limit-form input {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    flex: 1;
    min-width: 200px;
}

/* ==========================================================================
   Alerts & Messages
   ========================================================================== */
.alert {
    display: none;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

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

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

.alert-warning, .alert.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

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

/* ==========================================================================
   Boxes
   ========================================================================== */
.info-box {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #856404;
}

.info-box ul {
    margin-left: 20px;
    margin-top: 8px;
}

.info-box li {
    margin-bottom: 5px;
}

.warning-box {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    text-align: center;
}

.warning-box h2 {
    color: #856404;
    font-size: 24px;
    margin-bottom: 15px;
}

.warning-box p {
    color: #856404;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.warning-box .btn {
    max-width: 300px;
    margin: 0 auto;
}

.result-box {
    display: none;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.result-box h3 {
    color: #333;
    font-size: 18px;
    margin-bottom: 15px;
}

.result-link {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #d0d0d0;
    word-break: break-all;
    font-family: monospace;
    font-size: 13px;
    margin-bottom: 15px;
}

.secret-display {
    display: none;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.secret-display pre {
    background: white;
    padding: 15px;
    border-radius: 6px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.6;
}

/* ==========================================================================
   Content Sections
   ========================================================================== */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

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

.stat-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #3b6295;
}

.stat-label {
    color: #666;
    margin-top: 5px;
    font-size: 14px;
}

/* ==========================================================================
   Tables
   ========================================================================== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th {
    background: #3b6295;
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 500;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 25px;
}

th.sortable:hover {
    background: #334e77;
}

th.sortable::after {
    content: '\21C5';
    position: absolute;
    right: 8px;
    opacity: 0.5;
}

th.sortable.sorted-desc::after {
    content: '\2193';
    opacity: 1;
}

th.sortable.sorted-asc::after {
    content: '\2191';
    opacity: 1;
}

td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
}

tr:hover {
    background: #f8f9fa;
}

.success-text, .success {
    color: #28a745;
    font-weight: bold;
}

.failed-text, .failed {
    color: #dc3545;
    font-weight: bold;
}

.no-logs {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* ==========================================================================
   Meta Info
   ========================================================================== */
.meta-info {
    font-size: 13px;
    color: #666;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.meta-info div {
    margin-bottom: 5px;
}

.optional-action {
    text-align: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

/* ==========================================================================
   Loader
   ========================================================================== */
.loader {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
    display: block;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    color: #fff;
    font-size: 12px;
    clear: both;
    width: 100%;
}

.footer a {
    color: #fff;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.footer-links {
    margin-top: 10px;
    font-size: 11px;
}

.footer-links .separator {
    margin: 0 10px;
    color: #fff;
}

/* ==========================================================================
   Login Box (für logs.php Login)
   ========================================================================== */
.login-box {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 100%;
    padding: 40px;
}

.login-box h1 {
    color: #3b6295;
    margin-bottom: 20px;
    text-align: center;
}

.login-box .error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

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

/* ==========================================================================
   Language Switcher
   ========================================================================== */
.language-switcher {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 5px;
    z-index: 100;
}

.lang-option {
    padding: 6px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    background: white;
    color: #666;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.lang-option:hover {
    border-color: #3b6295;
    color: #3b6295;
}

.lang-option.active {
    background: #3b6295;
    border-color: #3b6295;
    color: white;
}

/* Container needs relative positioning for language switcher */
.container {
    position: relative;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 600px) {
    .container {
        padding: 24px;
    }

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

    .header h1 {
        font-size: 24px;
    }

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

    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
    }

    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
    }

    .rate-limit-form {
        flex-direction: column;
    }

    .rate-limit-form input {
        width: 100%;
    }
}
