/*
 * VOIP Manager - Base Styles
 * Common styles for all themes
 */

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

html {
    transition: background 0.5s ease, color 0.5s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-attachment: fixed;
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.5s ease, color 0.5s ease;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Page Header */
.page-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

.site-title {
    font-size: 2em;
    font-weight: 700;
    margin: 0 0 10px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.page-name {
    font-size: 1.3em;
    font-weight: 500;
    margin: 0;
}

/* Header */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 15px;
    font-weight: 600;
}

h1 {
    font-size: 2.5em;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
}

h2 {
    font-size: 2em;
    border-bottom: 2px solid;
    padding-bottom: 10px;
}

h3 {
    font-size: 1.5em;
}

/* Navigation */
nav {
    position: relative;
    z-index: 1000;
    backdrop-filter: blur(10px);
    padding: 15px 0;
    margin-bottom: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid;
}

nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 20px;
    justify-content: center;
}

nav ul li {
    display: inline-block;
}

nav a {
    text-decoration: none;
    padding: 10px 20px;
    display: block;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: transparent;
    border: 1px solid transparent;
}

nav a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

nav a.active {
    font-weight: 600;
}

/* Theme Dropdown */
.theme-dropdown {
    position: relative;
    margin-left: auto;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px !important;
    border-radius: 6px;
    text-decoration: none !important;
}

.theme-icon {
    font-size: 1.2em;
}

.theme-label {
    font-size: 0.9em;
    font-weight: 500;
}

.dropdown-arrow {
    font-size: 0.7em;
    transition: transform 0.3s ease;
}

.theme-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.theme-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 10px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    min-width: 180px;
    z-index: 9999;
}

.theme-dropdown.active .theme-dropdown-content {
    display: block;
}

.theme-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
}

.theme-option:first-child {
    border-radius: 8px 8px 0 0;
}

.theme-option:last-child {
    border-radius: 0 0 8px 8px;
}

.theme-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #999999;
    flex-shrink: 0;
}

.theme-option.active .theme-color {
    border-color: #ffffff;
}

/* Cards */
.card {
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    border: 1px solid;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

/* Tables */
.card table,
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 20px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.card {
    overflow-x: visible;
}

thead {
    font-weight: 600;
}

th {
    padding: 8px 5px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8em;
    letter-spacing: 0.2px;
    border-bottom: 2px solid;
}

td {
    padding: 6px 5px;
    border-bottom: 1px solid;
    font-size: 0.85em;
}

tbody tr {
    transition: all 0.2s ease;
}

tbody tr:hover {
    transition: all 0.2s ease;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Forms */
form {
    border-radius: 12px;
    border: 1px solid;
    padding: 30px;
}

form[style*="display: inline"],
form[style*="display:inline"] {
    background: none;
    padding: 0;
    border: none;
    margin: 0;
    display: inline-block;
    vertical-align: middle;
}

.form-group {
    margin-bottom: 20px;
}

/* Card padding for forms */
.card form {
    padding: 30px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="number"]::placeholder,
textarea::placeholder {
    opacity: 0.7;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border: 2px solid;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

/* Buttons */
button,
.btn,
input[type="submit"],
input[type="button"] {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary,
input[type="submit"] {
    /* Colors and shadows defined in theme CSS */
}

.btn-primary:hover,
input[type="submit"]:hover {
    transform: translateY(-2px);
    /* Shadows defined in theme CSS */
}

.btn-secondary {
    border: 1px solid;
}

.btn-secondary:hover {
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef5350 0%, #e53935 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 83, 80, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 83, 80, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #ffa726 0%, #fb8c00 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 167, 38, 0.3);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 167, 38, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #66bb6a 0%, #4caf50 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 187, 106, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 187, 106, 0.4);
}

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

.btn-small {
    padding: 2px 4px;
    font-size: 0.75em;
    line-height: 1.2;
    min-width: 0;
    white-space: nowrap;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-form {
    display: inline-block;
    margin: 0 1px;
    padding: 0;
}

.inline-form button {
    margin: 0;
    padding: 2px 4px;
    font-size: 0.75em;
}

.actions-column {
    min-width: 200px;
    word-break: break-word;
    white-space: normal;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success {
    background: rgba(102, 187, 106, 0.15);
    border-color: #66bb6a;
    color: #66bb6a;
}

.alert-danger {
    background: rgba(239, 83, 80, 0.15);
    border-color: #ef5350;
    color: #ef5350;
}

.alert-warning {
    background: rgba(255, 167, 38, 0.15);
    border-color: #ffa726;
    color: #ffa726;
}

.alert-info {
    background: rgba(100, 181, 183, 0.15);
    border-color: #64b5b7;
    color: #64b5b7;
}

/* Message */
.message {
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 8px;
    font-weight: 500;
}

.message.success {
    background: rgba(102, 187, 106, 0.15);
    border: 1px solid #66bb6a;
    color: #66bb6a;
}

.message.error {
    background: rgba(239, 83, 80, 0.15);
    border: 1px solid #ef5350;
    color: #ef5350;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    margin: 20px 0;
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    padding: 25px;
    border-radius: 12px;
    border: 1px solid;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.stat-card h3 {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.stat-card .stat-value {
    font-size: 3em;
    font-weight: 700;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* Search Box */
.search-box {
    margin: 20px 0;
}

.search-box input {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.1em;
    border: 2px solid;
    border-radius: 10px;
}

.search-box input:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.1);
}

/* Quick Links */
.quick-links {
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid;
}

.quick-links h3 {
    margin-bottom: 15px;
}

.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.quick-link-group {
    border-radius: 8px;
    padding: 15px;
    border: 1px solid;
    transition: all 0.2s ease;
}

.quick-link-group:hover {
    border-color:;
    transition: all 0.2s ease;
}

.quick-link-group h4 {
    font-size: 1em;
    margin-bottom: 10px;
    border-bottom: 1px solid;
    padding-bottom: 8px;
}

.quick-link-category {
    text-decoration: none;
    display: block;
    padding: 5px 0;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.quick-link-category:hover {
    padding-left: 8px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 500;
    color: #ffffff;
}

.badge-success {
    background: #22c55e;
    color: #ffffff;
}

.badge-danger {
    background: #ef4444;
    color: #ffffff;
}

.badge-info {
    background: #3b82f6;
    color: #ffffff;
}

.badge-active {
    background: #22c55e;
    color: #ffffff;
}

.badge-inactive {
    background: #6b7280;
    color: #ffffff;
}

.badge.badge-admin,
.badge.badge-manager {
    /* Background and color defined in theme CSS */
}

/* Login Page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 40px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.login-card h1 {
    text-align: center;
    margin-bottom: 30px;
}

/* Editable cells */
.editable {
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background 0.2s;
    display: inline-block;
    min-width: 60px;
}

.editable:hover {
    background: #1565c0;
    color: #ffffff;
}

.edit-input {
    width: 100%;
    padding: 6px 10px;
    border: 2px solid;
    border-radius: 4px;
    font-size: 14px;
}

/* Tab Management - Hide specific tab links */
.tab-link[href*="?tab=hierarquia"] {
    display: none;
}

/* Green Action Buttons */
.btn-add,
button[class*="btn"][onclick*="Adicionar"],
.btn-success-action {
    /* Colors defined in theme CSS */
}

/* File Upload & Processing Buttons */
.btn-file,
input[type="file"] + .btn,
.btn[onclick*="file"],
button[type="submit"].btn,
input[type="submit"].btn,
button[onclick*="Processar"],
button[type="submit"][value*="Processar"],
input[type="submit"][value*="Processar"] {
    /* Colors defined in theme CSS */
}

/* Increase spacing around elements */
.upload-area,
.drag-drop-area {
    padding: 20px;
    margin: 20px 0;
}

.btn-group {
    gap: 15px;
}

/* Table Cell Font Size & Formatting Consistency */
.voip-number,
.hierarchy-text {
    font-size: 15px !important;
    font-weight: 400 !important;
    color: var(--text-primary) !important;
}

.voip-number.editable:hover,
.hierarchy-text.editable:hover {
    color: #ffffff !important;
}

/* VOIP Table auto-sizing */
#voipsTable {
    table-layout: auto !important;
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

#voipsTable td,
#voipsTable th {
    word-wrap: normal !important;
    overflow-wrap: normal !important;
    white-space: normal !important;
    vertical-align: middle !important;
}

/* First column - Número VOIP auto-fit */
#voipsTable td:first-child,
#voipsTable th:first-child {
    white-space: nowrap !important;
    width: auto !important;
}

.voip-number {
    white-space: nowrap !important;
    display: inline-block !important;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.float-right {
    float: right;
}

.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* Responsive */

/* Tablets - 768px and below */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 1.8em;
    }

    h2 {
        font-size: 1.5em;
    }

    h3 {
        font-size: 1.2em;
    }

    nav ul {
        flex-direction: row;
        gap: 8px;
        padding: 0 10px;
    }

    nav a {
        padding: 8px 12px;
        font-size: 0.9em;
    }

    table {
        font-size: 0.85em;
    }

    th, td {
        padding: 10px;
    }

    .card {
        padding: 15px;
    }

    button, .btn, input[type="submit"], input[type="button"] {
        padding: 10px 16px;
        font-size: 0.9em;
    }

    .btn-sm, .btn-small {
        padding: 6px 12px;
        font-size: 0.8em;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card .stat-value {
        font-size: 2em;
    }

    form {
        padding: 15px;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        padding: 10px;
        font-size: 0.95em;
    }

    .login-card {
        padding: 25px;
    }
}

/* Mobile Phones - 480px and below */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .page-header {
        padding: 10px 0;
        margin-bottom: 15px;
    }

    .site-title {
        font-size: 1.3em;
    }

    .page-name {
        font-size: 1em;
    }

    h1 {
        font-size: 1.4em;
    }

    h2 {
        font-size: 1.2em;
    }

    h3 {
        font-size: 1em;
    }

    nav {
        padding: 10px 0;
        margin-bottom: 15px;
    }

    nav ul {
        gap: 3px;
        padding: 0 8px;
    }

    nav a {
        padding: 6px 10px;
        font-size: 0.8em;
    }

    table {
        font-size: 0.75em;
        margin: 10px 0;
    }

    thead {
        font-size: 0.7em;
    }

    th {
        padding: 6px;
        font-size: 0.75em;
    }

    td {
        padding: 6px;
        font-size: 0.75em;
    }

    .card {
        padding: 10px;
        margin-bottom: 15px;
    }

    .card h2 {
        font-size: 1.1em;
        margin-bottom: 10px;
    }

    button, .btn, input[type="submit"], input[type="button"] {
        padding: 8px 12px;
        font-size: 0.85em;
        min-width: 70px;
    }

    .btn-sm, .btn-small {
        padding: 4px 8px;
        font-size: 0.75em;
        min-width: 50px;
    }

    .btn-group {
        flex-direction: column;
        gap: 8px;
    }

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

    .stat-card {
        padding: 10px;
        margin-bottom: 10px;
    }

    .stat-card h3 {
        font-size: 0.9em;
        margin-bottom: 5px;
    }

    .stat-card .stat-value {
        font-size: 1.8em;
    }

    form {
        padding: 10px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    label {
        font-size: 0.9em;
        margin-bottom: 4px;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        padding: 8px;
        font-size: 0.9em;
        border-radius: 6px;
    }

    textarea {
        min-height: 60px;
    }

    .login-card {
        padding: 15px;
    }

    .login-card h1 {
        font-size: 1.3em;
        margin-bottom: 20px;
    }

    .quick-links-grid {
        grid-template-columns: 1fr;
    }

    .badge {
        font-size: 0.75em;
        padding: 4px 8px;
    }

    .search-box input {
        padding: 10px;
        font-size: 1em;
    }

    .editable {
        min-width: 50px;
        padding: 4px 6px;
        font-size: 0.9em;
    }

    .edit-input {
        padding: 4px 6px;
        font-size: 0.9em;
    }

    /* Utility spacing for mobile */
    .mt-1 { margin-top: 5px; }
    .mt-2 { margin-top: 10px; }
    .mt-3 { margin-top: 15px; }
    .mb-1 { margin-bottom: 5px; }
    .mb-2 { margin-bottom: 10px; }
    .mb-3 { margin-bottom: 15px; }
}

/* Extra small devices - 320px and below */
@media (max-width: 320px) {
    .container {
        padding: 8px;
    }

    .site-title {
        font-size: 1em;
    }

    .page-name {
        font-size: 0.9em;
    }

    h2 {
        font-size: 1em;
    }

    nav a {
        padding: 4px 6px;
        font-size: 0.7em;
    }

    button, .btn, input[type="submit"], input[type="button"] {
        padding: 6px 10px;
        font-size: 0.8em;
    }

    table {
        font-size: 0.65em;
    }

    th, td {
        padding: 4px;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card,
.stat-card {
    animation: fadeIn 0.5s ease-out;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    opacity: 0.8;
}
