/* style.css */

body {
    font-family: Arial, sans-serif;
    background-color: #FFFFFF;
    color: #333333;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* HEADER */
header {
    background-color: #283332;  /* Hiili */
    color: #f89420;  /* Oranssi (for logo/brand text, see also img) */
    padding: 20px;
}

header h1 {
    margin: 0;
}

header img {
    float: left;
    margin-right: 15px;
    height: 50px;
    width: auto;
}

header::after {
    content: "";
    display: table;
    clear: both;
}

/* NAVIGATION */
nav {
    background-color: #DFDFDF;
    padding: 15px;
}

nav a {
    text-decoration: none;
    color: #283332; /* Hiili */
}

nav a:hover {
    color: #f89420; /* Oranssi */
}

/* MAIN CONTENT */
main {
    padding: 20px;
    padding-bottom: 40px; /* Add extra bottom padding for better flow to footer */
    flex: 1; /* Takes up remaining space, pushing footer to bottom */
}

/* FOOTER */
footer {
    background-color: #283332; /* Hiili */
    color: #FFFFFF;
    text-align: center;
    padding: 30px 20px;
    margin-top: auto; /* Pushes footer to bottom when content is short */
    width: 100%;
    box-sizing: border-box;
    border-top: 3px solid #f89420; /* Oranssi accent border */
}

.footer-content p {
    margin: 8px 0;
    line-height: 1.4;
}

.footer-content p:first-child {
    font-weight: bold;
    font-size: 1.1em;
}

.footer-content p:last-child {
    font-size: 0.9em; 
    opacity: 0.8;
}

/* TABLE STYLES */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px; /* Reduced from 80px since footer is no longer fixed */
}

th, td {
    border: 1px solid #DFDFDF;
    padding: 10px;
    text-align: left;
}

th {
    background-color: #DFDFDF;
    color: #283332; /* Hiili */
}

/* Highlighted table row, e.g. selection or "active" row */
tr.highlighted, td.highlighted, th.highlighted {
    background-color: #de7a07ff; /* Highlighted text background */
    color: #fff;
}

/* PRIMARY BUTTON */
.button-primary,
button.button-primary,
input[type="submit"].button-primary {
    background: #f89420;
    color: #0d0d0dff;
}

/* SECONDARY/DEFAULT BUTTON */
button,
.button,
input[type="submit"],
input[type="button"] {
    background: #283332;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 8px 18px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

button:hover,
.button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
    background: #444f4f;
    color: #fff;
}

/* If you want a separate style for 'destructive': */
.button-danger,
button.button-danger {
    background: #cc2027;
    color: #fff;
}

/* Language selector */
.header-badge {
    margin-right: 8px;
    display: inline-flex;
    align-items: center;
    padding: 2px 4px 2px 2px;
    color: #283332;
    background-color: #f89420;
    border-radius: 9999px; /* Fully rounded for 'rounded-pill' */
    font-size: 0.9em;
}

/* Language dropdown */
.language-dropdown {
    position: relative;
    display: inline-block;
}
.language-toggle {
    border: none;
    background: none;
    padding: 2px 4px 2px 4px;
    border-radius: 6px;
    font-size: 0.9em;
    outline: none;
    cursor: pointer;
    font-weight: bold;
    color: #283332;
    display: flex;
    align-items: center;
    gap: 4px;
}
.language-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}
.language-options {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #DFDFDF;
    border-radius: 4px;
    box-shadow: 0px 4px 8px rgba(0,0,0,0.1);
    z-index: 1000;
    max-width: 100px;
    margin-top: 2px;
}
.lang-option {
    display: block;
    width: 100%;
    padding: 6px 12px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.9em;
    color: #283332;
    transition: background-color 0.2s;
}
.lang-option:hover {
    background-color: lightslategray;
}
.lang-option.active {
    background-color: #f89420;
    color: #283332;
    font-weight: bold;
}
.lang-option.active:hover {
    background-color: #de7a07;
}
.lang-text-flag {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}
.flag-icon {
    width: 15px;
    height: 15px;
    font-size: 15px;
    border-radius: 100%;
    border: none;
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .06);
    background: white;
}

/* Legacy badge-selector styles for backward compatibility */
.badge-selector {
    border: none;
    background: none;
    padding: 2px 0px 2px 4px;
    border-radius: 6px; /* boder rounding */
    font-size: 0.9em; /* prevent browser resizing */
    outline: none; /* removes blue focus ring */
    appearance: none; /* removes OS default arrow for a "flatter" look */
    cursor: pointer; /* shows clickable cursor */
    font-weight: bold;
}
.badge-selector:hover {
    background: #fff;
}

/* Login Info */
.login-info {
    margin-right: 8px;
    font-size: 0.9em;
    display: inline-flex;
    align-items: center;
}
.login-info i {
    color: gray;
    margin-right: 4px;
}
.login-info span {
    color: white;
}

/* Logout button */
.logout-button {
    text-decoration: none;
    color: #f89420;
    font-weight: bold;
    padding: 3px 3px; /* Medium button size */
    font-size: 0.9em;
    border-radius: 4px;
}
.logout-button:hover {
    color: #fff;
}

/* PAGINATION (if using DataTables or Django built-in pagers) */
/* Basic Django pagination styling */
.pagination .active a {
    background: #f89420;
    color: #283332 !important;
    border: none;
    font-weight: bold;
}

/* DataTables pagination styling to match site theme */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    background: #e0e0e0 !important;
    color: #283332 !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    padding: 6px 12px !important;
    margin: 0 2px !important;
    text-decoration: none !important;
    font-size: 0.9em !important;
    transition: all 0.2s !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #ccc !important;
    color: #283332 !important;
    border-color: #aaa !important;
}

/* Active/current pagination button - Orange theme */
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #f89420 !important; /* Oranssi - brand orange */
    color: #283332 !important; /* Hiili - dark text for contrast */
    border-color: #f89420 !important;
    font-weight: bold !important;
}

/* Disabled pagination buttons */
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    background: #f8f9fa !important;
    color: #6c757d !important;
    border-color: #dee2e6 !important;
    cursor: not-allowed !important;
}

/* DataTables info text styling */
.dataTables_wrapper .dataTables_info {
    color: #495057;
    font-size: 0.9em;
    padding-top: 8px;
}

/* DataTables length selector styling */
.dataTables_wrapper .dataTables_length select {
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 4px 8px;
    color: #495057;
}

/* DataTables search input styling */
.dataTables_wrapper .dataTables_filter input {
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 6px 12px;
    color: #495057;
    margin-left: 8px;
}

/* DataTables wrapper general improvements */
.dataTables_wrapper {
    margin-top: 20px;
    margin-bottom: 10px;
}

.dataTables_wrapper .dataTables_paginate {
    margin-top: 15px;
}

/* Ensure pagination buttons don't get cut off */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    box-sizing: border-box;
}

/* MESSAGES STYLES */
.messages-container {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 1.05rem;
    margin-bottom: 10px;
    border: 1px solid transparent;
    box-shadow: 0 1px 6px rgba(0,0,0,0.03);
    transition: background 0.2s;
}

.alert-success {
    background: #e6ffed;
    color: #27753d;
    border-color: #b2f5bf;
}

.alert-error, .alert-danger {
    background: #ffebeb;
    color: #8a1f1f;
    border-color: #f5b2b2;
}

.alert-info {
    background: #e8f7ff;
    color: #225875;
    border-color: #b2def5;
}

.alert-warning {
    background: #fff8e1;
    color: #876c18;
    border-color: #f5e8b2;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px; /* Space between elements */
}

.card-sm {
    width: 800px;
}

/* DataTables Buttons styled as secondary/default */
.dt-button, .buttons-csv {
    background: #283332 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 5px !important;
    padding: 8px 18px !important;
    font-size: 1em !important;
    cursor: pointer !important;
    transition: background 0.2s, color 0.2s !important;
    box-shadow: none !important;
}

.dt-button:hover, .buttons-csv:hover {
    background: #444f4f !important;
    color: #fff !important;
}

/* Error list styles */
.errorlist {
    color: #cc2027;         /* Your error red, or #d90429 or #dc3545 */
    background: #fff2f2;    /* Soft error background */
    padding: 10px 16px;
    border-radius: 5px;
    border: 1px solid #f5b2b2;
    margin-bottom: 10px;
    margin-top: 2px;
    list-style: none;
}

.errorlist li {
    margin-left: 0;
    font-size: 1em;
    font-weight: bold;
}

.text-danger {
  color: #cc2027;
  font-size: 0.95em;
}

/* Main navigation styles */
.main-nav {
    background-color: #f2f2f2;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.main-nav a, .dropbtn {
    background-color: #e0e0e0;
    color: black;
    padding: 10px;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

/* Disabled dropdown button appearance */
.dropbtn.disabled-dropbtn,
.dropbtn.disabled-dropbtn:hover {
    background-color: #f2f2f2; /* muted background */
    color: #6c757d; /* muted text */
    cursor: not-allowed;
    opacity: 0.9;
}

.dropbtn.disabled-dropbtn i {
    color: inherit; /* lock icon matches muted color */
}

/* Active navigation states */
.dropdown.active .dropbtn,
a.active {
    background-color: #f89420; /* Oranssi - your brand orange */
    color: #283332; /* Hiili - dark text for contrast */
    font-weight: bold;
}

.dropdown.active .dropbtn:hover {
    background-color: #de7a07; /* Slightly darker orange on hover */
    color: #283332;
}

a.active:hover {
    background-color: #de7a07; /* Slightly darker orange on hover */
    color: #283332;
}

/* Current page highlighting within dropdown menus */
.dropdown-content a.current-page {
    background-color: #f0f0f0;
    color: #f89420; /* Orange text for current page */
    font-weight: bold;
    border-left: 4px solid #f89420; /* Orange left border indicator */
}

.dropdown-content a.current-page:hover {
    background-color: #e0e0e0;
    color: #de7a07; /* Slightly darker orange on hover */
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 160px;
    margin: 0;
    border: 1px solid #DFDFDF;   /* Add this */
    box-shadow: 0px 8px 16px rgba(0,0,0,0.10);
    z-index: 1;
    left: 0; /* or right: 0; if you want to align differently */
}

.dropdown-content a {
    color: black;
    padding: 10px;
    text-decoration: none;
    display: block;
    border-radius: 0 !important;
    white-space: nowrap; /* Prevent word wrapping in dropdown menu items */
}

/* Prevent word wrapping in dropdown menu items */
.dropdown-content span.disabled-link {
    white-space: nowrap;
}

.dropdown-content a:hover {
    background-color: #ddd;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown:hover .dropbtn {
    background-color: #ccc;
}

nav a, .dropbtn {
    border-radius: 6px;
}

/* Icon button */
.help-icon-btn {
  background: lightseagreen;
  border: none;
  cursor: pointer;
  padding: 4px;
  font-size: 0.89em;
}

/* Form action-buttons container */
.form-action-buttons {
    padding-top: 13px;
    padding-bottom: 13px;
}

/* Form back button styling */
.form-back-btn {
    display: inline-block;
    background-color: #DFDFDF; /* Light gray background from site palette */
    color: #283332; /* Hiili text */
    border: none;
    border-radius: 5px;
    padding: 8px 18px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
}
.form-back-btn:hover {
    background-color: #d0d0d0;
    color: #283332; /* Hiili text */
    border-color: #bbb;
    text-decoration: none;
}

/* Product toggle button styling */
.toggle-products {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.85em;
    cursor: pointer;
    color: #495057;
    transition: all 0.2s;
}

.toggle-products:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.85em;
    line-height: 1.2;
}

/* Product details table styling */
.product-details table {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    overflow: hidden;
}

.product-details th,
.product-details td {
    border: 1px solid #dee2e6;
    padding: 4px 6px !important;
    font-size: 0.85em;
}

/* Voucher ticket management specific styles */
.voucher-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.action-buttons {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

/* Specific voucher ticket button styles - using brand colors */
.voucher-btn {
    display: inline-block;
    padding: 4px 8px;
    font-size: 14px;
    font-weight: normal;
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 3px;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
}

.voucher-btn:hover {
    text-decoration: none;
    opacity: 0.85;
    transform: translateY(-1px);
}

/* Brand-based button variants for voucher actions */
.voucher-btn-primary {
    color: #283332; /* Hiili text */
    background-color: #f89420; /* Oranssi background - brand orange */
    border-color: #e6841c;
}

.voucher-btn-primary:hover {
    background-color: #e6841c;
    border-color: #d17619;
}

.voucher-btn-secondary {
    color: #283332; /* Hiili text */
    background-color: #DFDFDF; /* Light gray background from site palette */
    border-color: #ccc;
}

.voucher-btn-secondary:hover {
    background-color: #d0d0d0;
    border-color: #bbb;
}

.voucher-btn-info {
    color: #fff;
    background-color: #17a2b8; /* Cyan/info blue */
    border-color: #138496;
}

.voucher-btn-info:hover {
    background-color: #138496;
    border-color: #117a8b;
}

.voucher-btn-success {
    color: #fff;
    background-color: #28a745; /* Green */
    border-color: #1e7e34;
}

.voucher-btn-success:hover {
    background-color: #1e7e34;
    border-color: #1c7430;
}

.voucher-btn-danger {
    color: #fff;
    background-color: #cc2027; /* Using existing danger color from site */
    border-color: #b01e24;
}

.voucher-btn-danger:hover {
    background-color: #b01e24;
    border-color: #9e1b20;
}

.voucher-btn-warning {
    color: #333;
    background-color: #f89420; /* Using site's orange color */
    border-color: #e6850e;
}

.voucher-btn-warning:hover {
    background-color: #e6850e;
    border-color: #d4770d;
    color: #fff;
}

.voucher-btn-dark {
    color: #fff;
    background-color: #283332; /* Hiili - brand dark */
    border-color: #283332;
}

.voucher-btn-dark:hover {
    background-color: #444f4f;
    border-color: #444f4f;
}

/* Small size variant for action buttons */
.voucher-btn-sm {
    padding: 2px 6px;
    font-size: 11px;
    line-height: 1.3;
    border-radius: 2px;
}

/* Disabled state */
.voucher-btn:disabled,
.voucher-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.voucher-btn:disabled:hover,
.voucher-btn.disabled:hover {
    transform: none;
    opacity: 0.5;
}

/* Icon spacing in voucher buttons */
.voucher-btn i {
    margin-right: 3px;
}

.voucher-btn i:only-child {
    margin-right: 0;
}

/* Bulk action button styling */
.bulk-action-btn {
    background-color: #283332; /* Hiili - brand dark */
    color: #fff;
    border: 1px solid #283332;
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 4px;
    transition: all 0.15s ease-in-out;
}

.bulk-action-btn:hover:not(:disabled) {
    background-color: #444f4f;
    border-color: #444f4f;
    transform: translateY(-1px);
}

.bulk-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #6c757d;
    border-color: #6c757d;
}

/* Bulk delete button - red styling for danger action */
.bulk-action-btn.bulk-delete-btn {
    background-color: #ba4848;
    border-color: #b01e24;
}

.bulk-action-btn.bulk-delete-btn:hover:not(:disabled) {
    background-color: #c35c59;
    border-color: #9e1b20;
}

.bulk-action-btn.bulk-delete-btn:disabled {
    background-color: #ba4848;
    border-color: #b01e24;
    opacity: 0.5;
}

/* Override any generic .btn classes that might interfere */
.action-buttons .voucher-btn {
    margin: 0 2px;
}

/* Ensure voucher action areas don't interfere with existing site buttons */
.voucher-actions .voucher-btn,
.action-buttons .voucher-btn {
    box-sizing: border-box;
}

/* Info card */
.info-card {
    border: 2px solid #ddd;
    border-radius: 4px;
    background-color: ghostwhite;
}
.info-card-header {
    padding-left: 8px;
}
.info-card-body {
    padding-left: 13px;
    padding-right: 13px;
}

/* HOME PAGE STYLES */
.home-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.home-header {
    text-align: center;
    margin-bottom: 40px;
}

.home-header h1 {
    color: #283332; /* Hiili */
    margin-bottom: 10px;
    font-size: 2.5em;
}

.home-header p {
    color: #666;
    font-size: 1.1em;
    max-width: 600px;
    margin: 0 auto;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.tool-card {
    background: #fff;
    border: 1px solid #DFDFDF;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.tool-card-header {
    background: #283332; /* Hiili */
    color: #fff;
    padding: 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tool-card-header i {
    font-size: 1.5em;
    color: #f89420; /* Oranssi */
}

.tool-card-header h2 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
}

.tool-card-body {
    padding: 20px;
}

.tool-card-body p {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
}

.tool-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    text-decoration: none;
    color: #283332; /* Hiili */
    transition: all 0.2s;
    font-size: 0.95em;
}

.tool-link:hover {
    background: #f89420; /* Oranssi */
    color: #fff;
    border-color: #f89420;
    text-decoration: none;
}

.tool-link i {
    font-size: 1em;
    width: 16px;
    text-align: center;
}

/* Disabled tool-link state (looks similar but muted and not clickable) */
.tool-link.disabled,
.tool-link.tool-link-disabled,
.tool-link.disabled:hover,
.tool-link.tool-link-disabled:hover {
    background: #f2f2f2; /* slightly muted background */
    color: #6c757d; /* muted text color */
    border-color: #e9ecef;
    cursor: not-allowed;
    text-decoration: none;
    transform: none;
}

/* class used in nav dropdown for disabled inline links */
.disabled-link {
    display: inline-block;
    padding: 10px 12px;
    color: #6c757d; /* muted */
    background: transparent;
    cursor: not-allowed;
    text-decoration: none;
}

/* External link styling */
.external-link-card .tool-card-header {
    background: #2c5aa0; /* Different color for external links */
}

.external-link-card .tool-card-header i {
    color: #87ceeb; /* Light blue accent */
}

.external-link {
    border-color: #2c5aa0;
}

.external-link:hover {
    background: #2c5aa0;
    border-color: #2c5aa0;
}

/* Login prompt styling */
.login-prompt {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    grid-column: 1 / -1; /* Span full width */
}

.login-prompt p {
    font-size: 1.1em;
    color: #666;
    margin-bottom: 20px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .home-container {
        padding: 15px;
    }
    
    .home-header h1 {
        font-size: 2em;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .tool-card-header {
        padding: 15px;
    }
    
    .tool-card-body {
        padding: 15px;
    }
    
    .tool-links {
        gap: 6px;
    }
    
    .tool-link {
        padding: 8px 12px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .home-header h1 {
        font-size: 1.8em;
    }
    
    .tool-card-header {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .tool-card-header i {
        font-size: 2em;
    }
}

/* Card component */
.card {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.card-body {
    padding: 20px;
}

.mb-3 {
    margin-bottom: 1rem;
}
