/* Modern Styles for Tool Management Panel */

/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #4361ee;
    --primary-hover: #3a56d4;
    --secondary-color: #7209b7;
    --danger-color: #2ecc71; /* Changed from red to green shade */
    --danger-hover: #27ae60; /* Changed from red to darker green shade */
    --light-bg: #f8f9fa;
    --dark-bg: #1a1b25;
    --sidebar-bg: #2b2d42;
    --sidebar-hover: #3c3f58;
    --text-color: #333;
    --light-text: #f1faee;
    --border-color: #e0e0e0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 6px 8px rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f5f7fa;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

ul {
    list-style: none;
}

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

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.header h1 {
    font-size: 28px;
    color: var(--primary-color);
    font-weight: 600;
}

.header nav ul {
    display: flex;
}

.header nav ul li {
    margin-left: 20px;
}

.header nav ul li a {
    padding: 10px 20px;
    border-radius: var(--border-radius);
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
    transition: var(--transition);
    display: inline-block;
}

.header nav ul li a:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    text-decoration: none;
}

/* Message Display */
.message {
    padding: 15px 20px;
    margin: 0 0 20px 0;
    border-radius: var(--border-radius);
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #0c5460;
    box-shadow: var(--shadow);
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Content Wrapper */
.content-wrapper {
    display: flex;
    min-height: calc(100vh - 140px);
    background-color: white;
    box-shadow: var(--shadow);
    border-radius: var(--border-radius);
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    flex: 0 0 280px;
    background-color: var(--sidebar-bg);
    color: var(--light-text);
    padding: 0;
}

.sidebar-search {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-search input {
    width: 100%;
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
}

.sidebar-search input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.sidebar-search input:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.15);
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-section h3 {
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.6);
    padding: 20px 20px 10px;
    margin-bottom: 5px;
}

.sidebar-section ul .tool-item {
    padding: 12px 20px;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-section ul .tool-item:hover {
    background-color: var(--sidebar-hover);
    border-left-color: var(--primary-color);
}

.sidebar-section ul .tool-item a {
    color: var(--light-text);
}

.sidebar-section ul .tool-item a:hover {
    text-decoration: none;
}

.sidebar-section ul .tool-item a.delete-link {
    color: var(--danger-color);
    font-size: 20px;
    font-weight: bold;
    opacity: 0.7;
    width: 25px;
    height: 25px;
    line-height: 22px;
    text-align: center;
    border-radius: 50%;
    transition: var(--transition);
}

.sidebar-section ul .tool-item a.delete-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

/* Dashboard */
.dashboard-stats {
    display: flex;
    margin-bottom: 20px;
    gap: 10px;
}

.stat-box {
    flex: 1;
    backgroundzona: pre;
    background-color: white;
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    border-top: 2px solid var(--primary-color);
}

.stat-box:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.stat-box h3 {
    font-size: 16px;
    color: #666;
    margin-bottom: 15px;
}

.stat-number {
    font-size: 36px;
    font-weight: bold;
    color: var(--primary-color);
}

.quick-actions {
    margin-top: 30px;
}

.quick-actions h3, .tools-list h3 {
    margin-bottom: 20px;
    font-size: 20px;
    color: #333;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    display: inline-block;
}

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

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

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.form-help {
    font-size: 13px;
    color: #777;
    margin-top: 8px;
}

.form-actions {
    margin-top: 30px;
    display: flex;
    gap: 15px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px; /* Slightly increased padding */
    background-color: #27ae60; /* Green shade */
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Added subtle shadow */
    text-transform: uppercase; /* Added uppercase text */
    letter-spacing: 0.5px; /* Added slight letter spacing */
}

.btn:hover {
    background-color: #219653; /* Darker green shade */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); /* Enhanced hover shadow */
}

.btn-primary {
    background-color: #27ae60; /* Green shade */
    color: white;
}

.btn-primary:hover {
    background-color: #219653; /* Darker green shade */
}

.btn-danger {
    background-color: var(--danger-color); /* Uses green shade from root */
    color: white;
}

.btn-danger:hover {
    background-color: var(--danger-hover); /* Uses darker green shade from root */
}

.btn-copy {
    margin cello-top: 10px;
}

.btn-small {
    padding: 8px 16px; /* Adjusted padding for small buttons */
    font-size: 12px;
}

/* Code Display */
.code-display {
    width: 100%;
    height: 120px;
    max-height: 120px;
    padding: 15px;
    background-color: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 10px;
    resize: none;
    overflow-y: auto;
}

.code-textarea {
    width: 100%;
    height: 300px;
    max-height: 300px;
    padding: 15px;
    background-color: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 10px;
    resize: none;
    overflow-y: auto;
}

/* Tool Details */
.tool-details, .tool-actions {
    margin-bottom: 30px;
}

.button-code h3 {
    margin-bottom: 15px;
    font-size: 18px;
    color: #444;
}

/* Error Messages */
.error {
    padding: 20px;
    background-color: #d4edda; /* Changed to green shade */
    color: #155724; /* Darker green text */
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

/* Tool List */
.tools-list {
    margin-top: 40px;
    background-color: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.dashboard-tools-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.dashboard-tools-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: var(--light-bg);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    border-left: 4px solid var(--primary-color);
    transition: var(--transition);
}

.dashboard-tools-list li:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.dashboard-tools-list li a {
    font-weight: 500;
    color: #444;
}

.tool-actions {
    display: flex;
    gap: 10px;
}

/* Bulk Delete */
.bulk-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.bulk-actions .selection-info {
    font-size: 14px;
    color: #666;
}

.tool-checkbox {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.tool-name-with-checkbox {
    display: flex;
    align-items: center;
}

.no-tools-message {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Add Tool Form */
.add-tool {
    background-color: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.add-tool h2 {
    margin-bottom: 25px;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    display: inline-block;
}

/* Update File Form */
.update-file {
    background-color: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.update-file h2 {
    margin-bottom: 25px;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    display: inline-block;
}

.button-code {
    background-color: var(--light-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-top: 30px;
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .content-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        flex: 0 0 auto;
        width: 100%;
    }
    
    .dashboard-stats {
        flex-direction: column;
    }
    
    .stat-box {
        margin-bottom: 20px;
    }
}

/* Cloud Script Styles */
.icon-cloud:before {
    content: "☁";
}

.cloud-script-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.script-header {
    margin-bottom: 20px;
}

.script-info {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    color: #666;
    font-size: 14px;
}

.script-url {
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.iframe-container {
    flex: 1;
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background-color: white;
    min-height: 500px;
}

.iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Make main content area flex when viewing cloud scripts */
.main-content {
    display: flex;
    flex-direction: column;
}

/* Search for cloud scripts */
#cloudScriptsList {
    max-height: 300px;
    overflow-y: auto;
}

/* Enhanced styles for the sidebar search */
.sidebar-search {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.sidebar-search input {
    width: 100%;
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
    transition: all 0.3s ease;
}

.sidebar-search input:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.3);
}

.sidebar-search input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Style when no results are found */
.sidebar-search input.no-results {
    background-color: rgba(46, 204, 113, 0.2); /* Changed to green shade */
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.sidebar-section h3.no-results {
    color: rgba(255, 255, 255, 0.3);
}

/* Add an indicator for search status */
.sidebar-search:after {
    content: '';
    position: absolute;
    top: 50%;
    right: 30px;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

.sidebar-search input:focus + .sidebar-search:after {
    background-color: var(--primary-color);
}

.sidebar-search input.no-results + .sidebar-search:after {
    background-color: var(--danger-color);
}